I'm trying to synchronize a file tree with a remote ftp server with TLS Explicit encryption in batch mode. The connection to that server is somwhat unstable, the transfer channel breaks after a while. When I do the synchronize for the first time, WinSCP automatically re-establishes the connection after it breaks. But for some reason this is not the case with each subsequent synchronize, then I get a timeout and the script just stops.
This is my script:
option batch abort
option transfer binary
open user@server
synchronize remote -delete C:\folder /folder
close
exit
This is what's happening when a connection breaks during first synchronize:
> 2014-06-15 23:25:55.904 PASV
< 2014-06-15 23:25:55.920 227 Entering Passive Mode (123,123,123,123,195,80)
> 2014-06-15 23:25:55.920 MLSD
. 2014-06-15 23:26:16.949 Transfer channel can't be opened.
. 2014-06-15 23:26:46.168 Timeout detected.
. 2014-06-15 23:26:46.168 Copying files to remote side failed.
. 2014-06-15 23:26:46.168 Connection was lost, asking what to do.
. 2014-06-15 23:26:46.168 Asking user:
. 2014-06-15 23:26:46.168 Lost connection. ("Transfer channel can't be opened.","Timeout detected.","Copying files to remote side failed.")
< 2014-06-15 23:26:46.168 Script: Lost connection.
< 2014-06-15 23:26:46.168 Script: Transfer channel can't be opened.
< 2014-06-15 23:26:46.168 Timeout detected.
< 2014-06-15 23:26:46.168 Copying files to remote side failed.
< 2014-06-15 23:26:52.408 Script: Connecting to server ...
And this is happening with each subsequent synchronize:
> 2014-06-15 23:46:58.758 PASV
< 2014-06-15 23:46:58.773 227 Entering Passive Mode (123,123,123,123,195,80)
> 2014-06-15 23:46:58.773 MLSD
. 2014-06-15 23:47:13.624 Timeout detected.
. 2014-06-15 23:47:13.624 Could not retrieve directory listing
< 2014-06-15 23:47:13.640 Script: Lost connection.
< 2014-06-15 23:47:13.640 Script: Timeout detected.
< 2014-06-15 23:47:13.640 Could not retrieve directory listing
< 2014-06-15 23:47:13.640 Error listing directory '/folder/some/path/bla/bla'.
How can I make WinSCP re-establish a broken connection after the first synchronize?