Posted: 2013-11-25 15:39
I have a batch file that runs a WinSCP script on a Windows box via a scheduled task.
The objective is to transfer the files via SFTP and then move the files to another folder. If the files fail to transfer, I do not want them to be moved.
The batch file:
if exist *.txt GOTO run
winscp.com /script=transfer.scr /xmllog=C:\transfer\!S-!Y-!M-!D-!T.xml
IF NOT ERRORLEVEL 0 GOTO Fail
move *.txt c:\transferred
The transfer script:
option batch abort
option confirm off
option transfer ascii
One recent transfer failure resulted in this message in the XML log:
<message>Network error: Connection refused.</message>
However, WinSCP must have returned with an exit of '0' - as the files were moved to the "transferred" folder.
Should WinSCP return with an error of '1' after the connection to the destination was refused?
Is there a better approach to get the behaviour I am seeking?
Location: Prague, Czechia
You can post new topics in this forum
And it's free!