Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Error code: 4 but %ERRORLEVEL% is 0

We need your script and full session log file.
Thulasiram

Error code: 4 but %ERRORLEVEL% is 0

I have tried the below code, the winscp logs error code as 4 but the errorlevel returning as 0 . Please let me know how to fix this.

SET WinSCP="C:\Program Files (x86)\WinSCP\WinSCP.com"
Call %WinSCP%   /ini="D:\WinSCP\WinSCP.ini" /script=%scriptfile% /log="%logfile%"
if %ERRORLEVEL% NEQ 0 (
   ECHO %date% : %time% winscp failed with error code=%ERRORLEVEL% .>>%logfile%   
)


Log :
< 2020-02-17 07:38:45.277 Status code: 4, Message: 1298, Server: Failure, Language:  

. 2020-02-17 07:38:45.277 Asking user:
. 2020-02-17 07:38:45.277 Error moving file 'fileA.txt' to 'Archive/fileA.txt'. ("General failure (server should provide error description).
. 2020-02-17 07:38:45.277 Error code: 4
. 2020-02-17 07:38:45.277 Error message from server: Failure
. 2020-02-17 07:38:45.277
. 2020-02-17 07:38:45.277 Common reasons for the Error code 4 are:
. 2020-02-17 07:38:45.277 - Renaming a file to a name of already existing file.
. 2020-02-17 07:38:45.277 - Creating a directory that already exists.
. 2020-02-17 07:38:45.277 - Moving a remote file to a different filesystem (HDD).
. 2020-02-17 07:38:45.277 - Uploading a file to a full filesystem (HDD).
. 2020-02-17 07:38:45.277 - Exceeding a user disk quota.")
< 2020-02-17 07:38:45.277 Script: Error moving file 'fileA.txt' to 'Archive/fileA.txt'.
< 2020-02-17 07:38:45.278 Script: General failure (server should provide error description).
< 2020-02-17 07:38:45.278 Error code: 4
< 2020-02-17 07:38:45.278 Error message from server: Failure
< 2020-02-17 07:38:45.278 Common reasons for the Error code 4 are:
< 2020-02-17 07:38:45.278 - Renaming a file to a name of already existing file.
< 2020-02-17 07:38:45.278 - Creating a directory that already exists.
< 2020-02-17 07:38:45.278 - Moving a remote file to a different filesystem (HDD).
< 2020-02-17 07:38:45.278 - Uploading a file to a full filesystem (HDD).
< 2020-02-17 07:38:45.278 - Exceeding a user disk quota.
< 2020-02-17 07:38:45.280 Script: fileA.txt
. 2020-02-17 07:38:45.280 Session upkeep
. 2020-02-17 07:38:45.281 Looking for network events
. 2020-02-17 07:38:45.281 Timeout waiting for network events
> 2020-02-17 07:38:45.281 Script: exit
. 2020-02-17 07:38:45.281 Session upkeep
. 2020-02-17 07:38:45.281 Looking for network events
. 2020-02-17 07:38:45.281 Timeout waiting for network events
. 2020-02-17 07:38:45.281 Script: Exit code: 0
. 2020-02-17 07:38:45.281 Script: Max roundtrip: 15
. 2020-02-17 07:38:45.282 Closing connection.
. 2020-02-17 07:38:45.282 Sending special code: 12
. 2020-02-17 07:38:45.282 Sent EOF message