How do I read success/failure in batch?
I currently have this script to upload a queue to a tablet;
But its behaving a bit strange.
It seems that when the destination has run out of space,
winscp still exits with errorlevel 0 the first time it loops around.
It does print "Error transferring file" before exiting though.
Am I doing it wrong?
@echo off set LOG=%CD%\log.txt set REMOTE_PATH=/Removable/MicroSD/ echo %date:~-4,4%/%date:~-7,2%/%date:~-10,2% %time:~0,8% QUEUE START >> %LOG% :LOOP set /p FILE= < "PPlist.txt" IF "%FILE%" neq "" ( echo %date:~-4,4%/%date:~-7,2%/%date:~-10,2% %time:~0,8% UPLOAD ATTEMPT : %FILE% >> %LOG% "C:\Program Files (x86)\WinSCP\winscp.com" /command ^ "option batch abort" ^ "option confirm off" ^ "open ftp://xxx:xxx@xxx.xxx.xxx.xxx:xxxx" ^ "put ""%FILE%"" %REMOTE_PATH%" ^ "exit" IF %ERRORLEVEL% == 0 ( echo %date:~-4,4%/%date:~-7,2%/%date:~-10,2% %time:~0,8% UPLOAD SUCCESS : %FILE% >> %LOG% more /E +1 "PPlist.txt" > "PPlist.txt.new" move /y "PPlist.txt.new" "PPlist.txt" ) ELSE echo %date:~-4,4%/%date:~-7,2%/%date:~-10,2% %time:~0,8% UPLOAD FAILURE : %FILE% >> %LOG% goto LOOP ) ELSE ( echo %date:~-4,4%/%date:~-7,2%/%date:~-10,2% %time:~0,8% QUEUE COMPLETE >> %LOG% exit )
It seems that when the destination has run out of space,
winscp still exits with errorlevel 0 the first time it loops around.
It does print "Error transferring file" before exiting though.
Am I doing it wrong?