WinSCP script fails to transfer file to a remote location

When I try to run a small script using WinSCP client below error throws while transferring the file to the remote server and getting aborted.

Error message

C:\WinSCP-5.9.6-Portable>WinSCP.com /script=ftptest.txt
Connecting to 192.169.2.33 ...
Connected
Starting the session...
Session started.
Active session: [1] ftpuser@192.169.2.33
transfer ascii
\...\audit.log.2018-04-10 | 0 B | 0.0 KB/s | binary | 0%
Error transferring file '\\MainShare\FDS\WS02\Logs\WhvEsbWrk2.MainShare.co.uk\audit.log.2018-04-10'.
Copying files to remote side failed.
Could not create file.
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort

Script which I have tried

open ftp://ftpuser:Mitrai17@192.169.2.33/ -hostkey="ssh-rsa 2048 ************************ ftpuser@Filezilla"
ascii
put -transfer=ascii \\MainShare\DFS\WS02\Logs\WhvEsbWrk2.MainShare.co.uk\audit.log.2018-04-10 /home/ftpuser/DK
exit
4

1 Answer

Assuming the /home/ftpuser/DK is a directory, you are missing a trailing slash. You should use:

put -transfer=ascii \\...\audit.log.2018-04-10 /home/ftpuser/DK/

When you use just the /home/ftpuser/DK, it means that you want to upload the file to the directory /home/ftpuser and save it to the file DK. What obviously conflicts with an existing subdirectory of the same name.

Quoting the documentation for the put command:

The last parameter specifies target remote directory and optionally operation mask to store file(s) under different name. Target directory must end with slash.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like