Errorlevel=1 even though file was transferred successfully

Advertisement

mfaarup
Joined:
Posts:
3
Location:
Australia, Sydney

Errorlevel=1 even though file was transferred successfully

Using version 4.1.5
Logfile states several errorcodes, but the last few ones are 0, meaning success???
All I get from errorlevel is 1, which then reports error in my script.
I am expecting some way of knowing that it completed successfully.

I believe I have tried all combinations of Option batch on|abort|continue and all checks of errorlevel 0|1 etc.

Any help greatly appreciated! only option I have left is to text-search through the logfile, which I find silly.

The file transfer works fine - only the errorlevel-bit is tricky!

Below is bat-script, ftp-script and logfile-piece

.bat file script:
winscp415.exe /log=logs\ftplog.log /script=transfer.ftp
if errorlevel 1 goto FTPError1

echo Success ftp 1
goto FTPend

:FTPError1
start /w %workdir%Pay_FTP_alert_bad.bat
%workdir%sleep 10
echo Error 1
goto FTPend

:FTPend
Other stuff

FTP Script:
prompt off
option confirm off
option batch abort
open xxxxx:password@server1
cd /server1/transfer/files
option transfer binary
put *.xml
close
exit

Logfile (last part):
Checking existence of file.
Type: SSH_FXP_LSTAT, Size: 90, Number: 64519
Type: SSH_FXP_STATUS, Size: 29, Number: 64519
Status/error code: 2
Checking existence of partially transfered file.
Type: SSH_FXP_LSTAT, Size: 99, Number: 64775
Type: SSH_FXP_STATUS, Size: 29, Number: 64775
Status/error code: 2
Opening remote file.
Type: SSH_FXP_OPEN, Size: 115, Number: 65027
Type: SSH_FXP_HANDLE, Size: 13, Number: 65027
Type: SSH_FXP_WRITE, Size: 32764, Number: 65542
468 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
Type: SSH_FXP_CLOSE, Size: 13, Number: 125956
Type: SSH_FXP_STATUS, Size: 24, Number: 125190
Type: SSH_FXP_STATUS, Size: 24, Number: 125446
Type: SSH_FXP_STATUS, Size: 24, Number: 125702
Type: SSH_FXP_STATUS, Size: 24, Number: 125956
Status/error code: 0
Type: SSH_FXP_RENAME, Size: 184, Number: 126226
Type: SSH_FXP_STATUS, Size: 24, Number: 126226
Status/error code: 0
Type: SSH_FXP_SETSTAT, Size: 102, Number: 65289
Type: SSH_FXP_STATUS, Size: 24, Number: 65289
Status/error code: 0
Closing connection.
Sending special code: 12
Sent EOF message

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Errorlevel=1 even though file was transferred successfully

There's no "prompt off" command in WinSCP. Please do not crosspost.

Reply with quote

mfaarup
Joined:
Posts:
3
Location:
Australia, Sydney

Re: Errorlevel=1 even though file was transferred successfully

martin wrote:

There's no "prompt off" command in WinSCP. Please do not crosspost.

Thanks for that - sorry for the first faulty post on the other thread!

Do you have any other suggestions to my problem with the errorlevel?

Reply with quote

martin
Site Admin
martin avatar

Re: Errorlevel=1 even though file was transferred successfully

mfaarup wrote:

Do you have any other suggestions to my problem with the errorlevel?
It still reports errorlevel 1 even after you have removed the "prompt off" command?

Reply with quote

mfaarup
Joined:
Posts:
3
Location:
Australia, Sydney

Re: Errorlevel=1 even though file was transferred successfully

martin wrote:

mfaarup wrote:

Do you have any other suggestions to my problem with the errorlevel?
It still reports errorlevel 1 even after you have removed the "prompt off" command?

I made a mistake in the script - now it works great!!
Thanks for the help and the great tool!!
Mikkel

Reply with quote

Advertisement

You can post new topics in this forum