Search code examples
batch-fileftpcommand-promptfile-transferwinscp

WinSCP - Transfer was successfully finished but nothing on virtual directory


My command prompt says the file transfer was successful. But I do not see any file imported from my local to my virtual directory. The file is gone though, upon import, due to the 'delete' command line.

Also, when I drag & drop the file on WinSCP, I see the file in the folder I want it to be.

Image:
command prompt: successful

on Advanced Site Settings dialog, virtual directory is : FWF FTP /Test/To_Synapse/Retail/Ready

And the file gets transferred to Archive folder upon import (cannot set directory to Archive folder).

Image2:
virtual directory screenshot on WinSCP

My .batch file:

C:\Program Files (x86)\WinSCP\WinSCP.com" /script="C:\path\to\script\FTPToFWFTest.txt

My .txt file:

option batch abort
option confirm off
open ftp://*****:******@***.**.**.**
lcd C:\local\path\
put -delete *.csv*
close
exit 

I will be as responsive as I can. Please leave any comment if you need clarification.

I'd very much appreciated experts help on this. Any guidance on this would be very helpful. Thank you in advance. I hope you all get warm and happy holidays!


Solution

  • As with your previous question, you seem to expect the script to pickup your WinSCP GUI configuration.

    It is possible, if you use the stored site name in the open command (open site_name) and make sure the script shares the configuration with the GUI.


    But this approach is discouraged. You better build your script to be independent of the GUI configuration. In which case, you have to specify the target folder in the script. E.g. using the cd command:

    cd /remote/path 
    

    or in the put command itself:

    put -delete *.csv* /remote/path/
    

    The easiest is to have the GUI generate the script for you.