I want to keep a local directory synced remotely through FTP. If my internet connection is ready, I can easily use WinSCP.com to connect to the FTP and keep files up-to-date using the command:
"c:\Program Files (x86)\WinSCP\WinSCP.com" /script=connect.script Where my script is:
# Connect open myftp # Change remote directory cd / # Set options option batch continue option reconnecttime 120 option confirm off # Synchronize synchronize remote # Keep Up-to-date keepuptodate -delete The FTP server is a Filezilla Server version 0.9.54 correctly set up. The 'myftp' parameter is a section configured and named using the WinSCP GUI.
Problem is: when I lose connection (like someone remove the cable from the server machine) the WinSCP service dies.
Connected Starting the session... Session started. Active session: [1] myftp / batch continue reconnecttime 120 reconnecttime 120 confirm off Comparing... Nothing to Synchronize. Watching for changes, press Ctrl-C to abort... Scanning '.' for subdirectories... Watching for changes in 2 directories... Lost connection. Disconnected from server Server is going offline Session 'myftp' closed. No session. winscp> I was expecting that the 'keepuptodate' would keep the section alive and retry during 120 seconds, based on parameter 'reconnecttime'. Why is it not happening?
I found a "trick" by using a Windows batch file and 'goto' command that keeps calling WinSCP if the session closes, but it is clumsy and I wonder if there is a better solution.
I'm using WinSCP version 5.7.6 .