Problem with certain hardcoded(?) Windows folders: "My Music","My Pictures","Application Data",etc.

Advertisement

charlesr
Joined:
Posts:
2
Location:
Illinois

Problem with certain hardcoded(?) Windows folders: "My Music","My Pictures","Application Data",etc.

I'm trying to use WinSCP do backups of a user folder from a freshly installed Windows 10 laptop to a linux machine. I am having problems with both gui and scripting modes. I am using the most recent update of WinSCP.

The problem appears to be with certain folder or file names which seem to be expected to appear in the users folder, or in subfolder such as "Documents". These seem to include names like "My Music", "My Pictures", "My Documents", "Local Settings", and some others. (Someone else has reported a similar problem: https://winscp.net/forum/viewtopic.php?t=25666. Perhaps also this: https://winscp.net/forum/viewtopic.php?t=13461.)

Note: These folders are not shown under Windows file explorer (not even as hidden files). However, if I try to create a folder with one of these names, Windows complains that it already exists! So I conjecture these are some kind of hardcoded names known to windows. (Are these folders are a legacy from some earlier version of Windows? I've searched for a Windows fix for this, but I can't find anything useful.)

If I try to use WinSCP, it chokes badly on any of these. For instance, in gui mode, it pops up an "Abort/Retry/Fail" type dialog, and there is no way to skip the bad folder without stopping the upload. I get a similar error in scripting mode, which in the log looks like:
. 2018-03-04 11:48:55.652 File: 'c:\Users\User Name\AppData\Local\Application Data' [2018-02-07T13:14:25.525Z] [0]
* 2018-03-04 11:48:55.653 (EDirectoryNotFoundException) The drive cannot be found
. 2018-03-04 11:48:55.653 Asking user:
. 2018-03-04 11:48:55.653 File or folder 'c:\Users\User Name\AppData\Local\Application Data' does not exist. ("The drive cannot be found")
< 2018-03-04 11:48:55.653 Script: File or folder 'c:\Users\User Name\AppData\Local\Application Data' does not exist.
< 2018-03-04 11:48:55.653 Script: The drive cannot be found
* 2018-03-04 11:48:55.655 (ESkipFile) File or folder 'c:\Users\User
Name\AppData\Local\Application Data' does not exist.
* 2018-03-04 11:48:55.655 The drive cannot be found
. 2018-03-04 11:48:55.655 Copying finished: Transferred: 1,765,833, Elapsed: 0:00:00, CPS: 15,899,944/s
. 2018-03-04 11:48:55.655 Script: Failed
. 2018-03-04 11:48:55.655 Script: Exit code: 1
. 2018-03-04 11:48:55.655 Closing connection.
. 2018-03-04 11:48:55.655 Sending special code: 12
. 2018-03-04 11:48:55.655 Sent EOF message

I am able to avoid some of these bad folders/files with "option exclude" lines in my script. But for some reason it doesn't work with "Application Data". I'm attaching the full log and script.
Description: Log.
Description: Script.

Reply with quote

Advertisement

charlesr

Another strange folder is "AppData", which does actually exist (as a hidden folder). Even though I have excluded it in the script, WinSCP wants to copy it anyway.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: Problem with certain hardcoded(?) Windows folders: "My Music","My Pictures","Application Data",etc.

Multiple option exclude commands overwrite one another.

Moreover a mask for a folder has to end with a (back)slash (as you correctly have with Documents\;Music\;Pictures\, etc).
https://winscp.net/eng/docs/file_mask#directory

Not to mention that option exclude command is deprecated since WinSCP 5.0.6 (2012).

You need this:
synchronize remote -filemask="|...;Application Data\;..."

Reply with quote

Advertisement

You can post new topics in this forum