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 ...
Starting the session...
Session started.
Active session: [1] ftpuser@
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@ -hostkey="ssh-rsa 2048 ************************ ftpuser@Filezilla"
put -transfer=ascii \\MainShare\DFS\WS02\Logs\WhvEsbWrk2.MainShare.co.uk\audit.log.2018-04-10 /home/ftpuser/DK
  • "Could not create file." You don't have write access to the target directory? Or there is a read-only file already there with the same name? – DavidPostill Apr 11 '18 at 13:35
  • drwxrwxrwx 2 ftpuser ftpuser 20480 Apr 11 19:09 DK @DavidPostill I have permission to that particular directory – Daz Apr 11 '18 at 13:40
  • 1
    No issues with the FTP server quota. I can confirm that @PimpJuiceIT – Daz Apr 11 '18 at 13:41
  • 1
    Disk space also fine @PimpJuiceIT Filesystem Size Used Avail Use% Mounted on /dev/sda1 193G 103G 81G 56% / – Daz Apr 11 '18 at 13:47

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.

  • Of course, the simple and obvious that's easily overlooked. +1 – Pimp Juice IT Apr 11 '18 at 13:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.