Topic "Errorlevel=1 even though file was transferred successfully"

Author Message
mfaarup
[View user's profile]

Joined: 2008-09-18
Posts: 3
Location: Australia, Sydney
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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
There's no "prompt off" command in WinSCP. Please do not crosspost.
_________________
Martin Prikryl
mfaarup
[View user's profile]

Joined: 2008-09-18
Posts: 3
Location: Australia, Sydney
prikryl 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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
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?
_________________
Martin Prikryl
mfaarup
[View user's profile]

Joined: 2008-09-18
Posts: 3
Location: Australia, Sydney
prikryl 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
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License