Post a reply

Tip: Styles can be applied quickly to selected text.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

jwatte

Scripted WinSCP fails with "File or folder 'Documents\My Music' does not exist"

I'm trying to use WinSCP to automate copying my local files to a backed up directory on a UNIX server.
(That directory in turn is backed up as part of the regular server backups.)
I run WinSCP using task scheduler, once a day.
Unfortunately, whenever it runs, it dies in the middle of trying to copy Documents, because it's trying to copy a non-existent "Documents\My Music" directory. Here is the error message:

> 2017-12-26 08:59:07.497 Type: SSH_FXP_LSTAT, Size: 113, Number: 16623367

< 2017-12-26 08:59:07.498 Type: SSH_FXP_ATTRS, Size: 37, Number: 16623367
. 2017-12-26 08:59:07.498 File: 'Documents\My Music' [2017-12-07T18:44:37.158Z] [0]
* 2017-12-26 08:59:07.499 (EDirectoryNotFoundException) The drive cannot be found
. 2017-12-26 08:59:07.499 Asking user:
. 2017-12-26 08:59:07.500 File or folder 'Documents\My Music' does not exist. ("The drive cannot be found")
< 2017-12-26 08:59:07.500 Script: File or folder 'Documents\My Music' does not exist.
< 2017-12-26 08:59:07.500 Script: The drive cannot be found
* 2017-12-26 08:59:07.500 (EScpSkipFile) File or folder 'Documents\My Music' does not exist.
* 2017-12-26 08:59:07.500 The drive cannot be found
. 2017-12-26 08:59:07.500 Copying finished: Transferred: 187,944, Elapsed: 0:00:00, CPS: 663,269/s
. 2017-12-26 08:59:07.500 Script: Failed
. 2017-12-26 08:59:07.500 Script: Exit code: 1
. 2017-12-26 08:59:07.500 Closing connection.


This directory doesn't exist in my Documents folder, so I imagine this is some Windows-specific special folder that WinSCP somehow picks up.
Is there some way to get WinSCP to ignore that this "folder" doesn't exist, and continue copying?
Or some way to explicitly exclude this particular folder?

Here is my backup script:

C:\Users\jwatte>type winscp-backup.txt

open sftp://xxxxxx/ -hostkey="ecdsa-sha2-nistp256 256 xxxxxxx"

lcd C:\Users\jwatte
cd /var/fileserver/backup/xxxxxx

put -neweronly code
put -neweronly Desktop
put -neweronly Documents
put -neweronly AppData

exit

# Execute the script using a command like:
# "C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="C:\writable\path\to\log\WinSCP.log" /ini=nul /script="C:\path\to\script\script.txt"