Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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: FTP Get (batch mode) with rc 1, but download ok

jdummerm wrote:

The problem descripted in bug 1210 is not the reason. Please check the log listed with header "SECOND RUN WITH RETURN CODE 0".

How does that contradict the bug description? Did you note the "is randomly reported" part?
jdummerm

Re: FTP Get (batch mode) with rc 1, but download ok

martin wrote:

Thanks for your report.

This bug has been added to the tracker:
https://winscp.net/tracker/1210

Note that you would never encounter the bug, had you followed the advice:
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.


I.e. do:

E:\Batch\Pgm\winscp\winscp.com /log=e:\logs\batch\shr\C68961E0.txt /command "option batch abort" "option confirm off" "open <session-id>" ...


The problem descripted in bug 1210 is not the reason. Please check the log listed with header "SECOND RUN WITH RETURN CODE 0".
martin

Re: FTP Get (batch mode) with rc 1, but download ok

Thanks for your report.

This bug has been added to the tracker:
https://winscp.net/tracker/1210

Note that you would never encounter the bug, had you followed the advice:
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.


I.e. do:

E:\Batch\Pgm\winscp\winscp.com /log=e:\logs\batch\shr\C68961E0.txt /command "option batch abort" "option confirm off" "open <session-id>" ...
jdummerm

FTP Get (batch mode) with rc 1, but download ok

WinsCP Version: 5.5.1 (in use since about 5 months)
Server: Windows Server 2003
Transfer protocol: FTP
Mode: batch job
script: call E:\Batch\Pgm\winscp\winscp.com <session-id> /log=e:\logs\batch\shr\C68961E0.txt /command "option batch abort" "option confirm off" "option transfer ascii" "get ""92/SAPHR2PD_UPD_201408205.TXT.TRANSFER"" ""\\FilerXXX\YYY\in\""" "exit
Problem: First run ends with return code 1 "2014-08-20 15:55:59.226 Script: Failed", but the file was successfully downloaded
Second run without changes ends with return code 0.
What's the reason for the message "Script: Failed"?



----------------------------------------
FIRST RUN WITH RETURN CODE 1
----------------------------------------
File SAPHR2PD_UPD_201408205.TXT.TRANSFER successfully downloaded!

STDOUT:
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Connecting to server77.YYY.ch ...
Connected with server77.YYY.ch. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] ftpbagjas-hp1@server77.YYY.ch
batch abort
confirm off
transfer ascii
SAPHR2PD_UPD_201408205.TXT.TRANSFER | 116 KiB | 3746.5 KiB/s | ascii | 100%
echo errorlevel=1


LOG (e:\logs\batch\shr\C68961E0.txt):
. 2014-08-20 15:55:59.132 --------------------------------------------------------------------------
. 2014-08-20 15:55:59.132 WinSCP Version 5.5.1 (Build 3970) (OS 5.2.3790 Service Pack 2 - Microsoft Windows Server 2003 R2)
. 2014-08-20 15:55:59.132 Configuration: E:\Batch\Pgm\winscp\WinSCP.ini
. 2014-08-20 15:55:59.132 Local account: NT-YYY1\streamworks
. 2014-08-20 15:55:59.132 Working directory: E:\batch\pgm
. 2014-08-20 15:55:59.132 Process ID: 60968
. 2014-08-20 15:55:59.132 Command-line: "E:\Batch\Pgm\winscp\WinSCP.exe" /console=551 /consoleinstance=_61408_405 "ftpbagjas-hp1@server77.YYY.ch" "/log=e:\logs\batch\shr\C68961E0.txt" "/command" "option batch abort" "option confirm off" "option transfer ascii" "get ""92/SAPHR2PD_UPD_201408205.TXT.TRANSFER"" ""\\FilerXXX\YYY\in\""" "exit"
. 2014-08-20 15:55:59.132 Time zone: Current: GMT+2, Standard: GMT+1, DST: GMT+2, DST Start: 30.03.2014, DST End: 26.10.2014
. 2014-08-20 15:55:59.132 Login time: Mittwoch, 20. August 2014 15:55:59
. 2014-08-20 15:55:59.132 --------------------------------------------------------------------------
. 2014-08-20 15:55:59.148 Script: Retrospectivelly logging previous script records:
< 2014-08-20 15:55:59.148 Script: Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
. 2014-08-20 15:55:59.148 --------------------------------------------------------------------------
. 2014-08-20 15:55:59.148 Session name: ftpbagjas-hp1@server77.YYY.ch (Site)
. 2014-08-20 15:55:59.148 Host name: server77.YYY.ch (Port: 21)
. 2014-08-20 15:55:59.148 User name: ftpbagjas-hp1 (Password: Yes, Key file: No)
. 2014-08-20 15:55:59.148 Tunnel: No
. 2014-08-20 15:55:59.148 Transfer Protocol: FTP
. 2014-08-20 15:55:59.148 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2014-08-20 15:55:59.148 Proxy: none
. 2014-08-20 15:55:59.148 Send buffer: 262144
. 2014-08-20 15:55:59.148 FTP: FTPS: None; Passive: Yes [Force IP: A]; MLSD: A [List all: A]
. 2014-08-20 15:55:59.148 Local directory: default, Remote directory: home, Update: No, Cache: No
. 2014-08-20 15:55:59.148 Cache directory changes: No, Permanent: Yes
. 2014-08-20 15:55:59.148 DST mode: 1; Timezone offset: 0h 0m
. 2014-08-20 15:55:59.148 --------------------------------------------------------------------------
. 2014-08-20 15:55:59.179 Connecting to server77.YYY.ch ...
. 2014-08-20 15:55:59.179 Connected with server77.YYY.ch. Waiting for welcome message...
< 2014-08-20 15:55:59.195 220 ftp server
> 2014-08-20 15:55:59.195 USER ftpbagjas-hp1
< 2014-08-20 15:55:59.195 331 Please specify the password.
> 2014-08-20 15:55:59.195 PASS *******
< 2014-08-20 15:55:59.211 230 Login successful.
> 2014-08-20 15:55:59.211 SYST
< 2014-08-20 15:55:59.211 215 UNIX Type: L8
> 2014-08-20 15:55:59.211 FEAT
< 2014-08-20 15:55:59.211 211-Features:
< 2014-08-20 15:55:59.211 EPRT
< 2014-08-20 15:55:59.211 EPSV
< 2014-08-20 15:55:59.211 MDTM
< 2014-08-20 15:55:59.211 PASV
< 2014-08-20 15:55:59.211 REST STREAM
< 2014-08-20 15:55:59.211 SIZE
< 2014-08-20 15:55:59.211 TVFS
< 2014-08-20 15:55:59.211 211 End
. 2014-08-20 15:55:59.211 Connected
. 2014-08-20 15:55:59.211 --------------------------------------------------------------------------
. 2014-08-20 15:55:59.211 Using FTP protocol.
. 2014-08-20 15:55:59.211 Doing startup conversation with host.
> 2014-08-20 15:55:59.211 PWD
< 2014-08-20 15:55:59.211 257 "/YYYDATAHCM/HP1"
. 2014-08-20 15:55:59.226 Getting current directory name.
. 2014-08-20 15:55:59.226 Startup conversation with host finished.
< 2014-08-20 15:55:59.226 Script: Active session: [1] ftpbagjas-hp1@server77.YYY.ch
. 2014-08-20 15:55:59.226 Script: Failed
> 2014-08-20 15:55:59.226 Script: option batch abort
< 2014-08-20 15:55:59.226 Script: batch abort
> 2014-08-20 15:55:59.226 Script: option confirm off
< 2014-08-20 15:55:59.226 Script: confirm off
> 2014-08-20 15:55:59.226 Script: option transfer ascii
< 2014-08-20 15:55:59.226 Script: transfer ascii
> 2014-08-20 15:55:59.226 Script: get "92/SAPHR2PD_UPD_201408205.TXT.TRANSFER" "\\FilerXXX\YYY\in\"
. 2014-08-20 15:55:59.226 Listing file "92/SAPHR2PD_UPD_201408205.TXT.TRANSFER".
. 2014-08-20 15:55:59.226 Retrieving directory listing...
> 2014-08-20 15:55:59.226 CWD /YYYDATAHCM/HP1/92/
< 2014-08-20 15:55:59.226 250 Directory successfully changed.
> 2014-08-20 15:55:59.226 PWD
< 2014-08-20 15:55:59.226 257 "/YYYDATAHCM/HP1/92"
> 2014-08-20 15:55:59.226 TYPE A
< 2014-08-20 15:55:59.226 200 Switching to ASCII mode.
> 2014-08-20 15:55:59.242 PASV
< 2014-08-20 15:55:59.242 227 Entering Passive Mode (10,123,192,196,47,50)
> 2014-08-20 15:55:59.242 LIST -a
< 2014-08-20 15:55:59.242 150 Here comes the directory listing.
< 2014-08-20 15:55:59.257 226 Directory send OK.
. 2014-08-20 15:55:59.273 drwxrwxrwx 2 4000 4000 8192 Aug 20 13:55 .
. 2014-08-20 15:55:59.273 drwxrwxrwx 39 4001 4000 4096 Aug 15 07:49 ..
. 2014-08-20 15:55:59.273 -rw-r--r-- 1 4018 4000 17049480 Aug 03 22:36 PD2SAPHR_20140803.txt
...
. 2014-08-20 15:55:59.273 -rwxrw-rw- 1 4008 4008 3680 Aug 03 07:26 SAPHR2PD_UPD_201408032.TXT.TRANSFER
...
. 2014-08-20 15:55:59.273 Directory listing successful
. 2014-08-20 15:55:59.273 SAPHR2PD_UPD_201408205.TXT.TRANSFER;-;118928;2014-08-20T10:26:00.000Z;"4008" [0];"4008" [0];rwxrw-rw-;1
. 2014-08-20 15:55:59.273 File: '/YYYDATAHCM/HP1/92/SAPHR2PD_UPD_201408205.TXT.TRANSFER' [2014-08-20T10:26:00.000Z] [118928]
. 2014-08-20 15:55:59.273 Copying "/YYYDATAHCM/HP1/92/SAPHR2PD_UPD_201408205.TXT.TRANSFER" to local directory started.
. 2014-08-20 15:55:59.273 Ascii transfer mode selected.
. 2014-08-20 15:55:59.273 Starting download of /YYYDATAHCM/HP1/92/SAPHR2PD_UPD_201408205.TXT.TRANSFER
> 2014-08-20 15:55:59.289 TYPE A
< 2014-08-20 15:55:59.304 200 Switching to ASCII mode.
> 2014-08-20 15:55:59.304 PASV
< 2014-08-20 15:55:59.304 227 Entering Passive Mode (10,123,192,196,163,137)
> 2014-08-20 15:55:59.304 RETR SAPHR2PD_UPD_201408205.TXT.TRANSFER
< 2014-08-20 15:55:59.320 150 Opening BINARY mode data connection for SAPHR2PD_UPD_201408205.TXT.TRANSFER (118928 bytes).
< 2014-08-20 15:55:59.336 226 File send OK.
. 2014-08-20 15:55:59.351 Download successful
> 2014-08-20 15:55:59.351 Script: exit
. 2014-08-20 15:55:59.351 Script: Exit code: 1
. 2014-08-20 15:55:59.351 Disconnected from server


----------------------------------------
SECOND RUN WITH RETURN CODE 0
----------------------------------------
File SAPHR2PD_UPD_201408205.TXT.TRANSFER successfully downloaded!

STDOUT:
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Connecting to server77.YYY.ch ...
Connected with server77.YYY.ch. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] ftpbagjas-hp1@server77.YYY.ch
batch abort
confirm off
transfer ascii
SAPHR2PD_UPD_201408205.TXT.TRANSFER | 116 KiB | 2471.1 KiB/s | ascii | 100%
echo errorlevel=0

LOG (e:\logs\batch\shr\C68961E0.txt):
. 2014-08-20 16:10:37.767 --------------------------------------------------------------------------
. 2014-08-20 16:10:37.767 WinSCP Version 5.5.1 (Build 3970) (OS 5.2.3790 Service Pack 2 - Microsoft Windows Server 2003 R2)
. 2014-08-20 16:10:37.767 Configuration: E:\Batch\Pgm\winscp\WinSCP.ini
. 2014-08-20 16:10:37.767 Local account: NT-YYY1\streamworks
. 2014-08-20 16:10:37.767 Working directory: E:\batch\pgm
. 2014-08-20 16:10:37.767 Process ID: 60032
. 2014-08-20 16:10:37.767 Command-line: "E:\Batch\Pgm\winscp\WinSCP.exe" /console=551 /consoleinstance=_59640_561 "ftpbagjas-hp1@server77.YYY.ch" "/log=e:\logs\batch\shr\C68961E0.txt" "/command" "option batch abort" "option confirm off" "option transfer ascii" "get ""92/SAPHR2PD_UPD_201408205.TXT.TRANSFER"" ""\\FilerXXX\YYY\in\""" "exit"
. 2014-08-20 16:10:37.767 Time zone: Current: GMT+2, Standard: GMT+1, DST: GMT+2, DST Start: 30.03.2014, DST End: 26.10.2014
. 2014-08-20 16:10:37.767 Login time: Mittwoch, 20. August 2014 16:10:37
. 2014-08-20 16:10:37.767 --------------------------------------------------------------------------
. 2014-08-20 16:10:37.799 Script: Retrospectivelly logging previous script records:
< 2014-08-20 16:10:37.799 Script: Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
. 2014-08-20 16:10:37.799 --------------------------------------------------------------------------
. 2014-08-20 16:10:37.799 Session name: ftpbagjas-hp1@server77.YYY.ch (Site)
. 2014-08-20 16:10:37.799 Host name: server77.YYY.ch (Port: 21)
. 2014-08-20 16:10:37.799 User name: ftpbagjas-hp1 (Password: Yes, Key file: No)
. 2014-08-20 16:10:37.799 Tunnel: No
. 2014-08-20 16:10:37.799 Transfer Protocol: FTP
. 2014-08-20 16:10:37.799 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2014-08-20 16:10:37.799 Proxy: none
. 2014-08-20 16:10:37.799 Send buffer: 262144
. 2014-08-20 16:10:37.799 FTP: FTPS: None; Passive: Yes [Force IP: A]; MLSD: A [List all: A]
. 2014-08-20 16:10:37.799 Local directory: default, Remote directory: home, Update: No, Cache: No
. 2014-08-20 16:10:37.799 Cache directory changes: No, Permanent: Yes
. 2014-08-20 16:10:37.799 DST mode: 1; Timezone offset: 0h 0m
. 2014-08-20 16:10:37.799 --------------------------------------------------------------------------
. 2014-08-20 16:10:37.830 Connecting to server77.YYY.ch ...
. 2014-08-20 16:10:37.830 Connected with server77.YYY.ch. Waiting for welcome message...
< 2014-08-20 16:10:37.830 220 ftp server
> 2014-08-20 16:10:37.846 USER ftpbagjas-hp1
< 2014-08-20 16:10:37.846 331 Please specify the password.
> 2014-08-20 16:10:37.846 PASS *******
< 2014-08-20 16:10:37.861 230 Login successful.
> 2014-08-20 16:10:37.861 SYST
< 2014-08-20 16:10:37.861 215 UNIX Type: L8
> 2014-08-20 16:10:37.861 FEAT
< 2014-08-20 16:10:37.861 211-Features:
< 2014-08-20 16:10:37.861 EPRT
< 2014-08-20 16:10:37.861 EPSV
< 2014-08-20 16:10:37.861 MDTM
< 2014-08-20 16:10:37.861 PASV
< 2014-08-20 16:10:37.861 REST STREAM
< 2014-08-20 16:10:37.861 SIZE
< 2014-08-20 16:10:37.861 TVFS
< 2014-08-20 16:10:37.861 211 End
. 2014-08-20 16:10:37.861 Connected
. 2014-08-20 16:10:37.861 --------------------------------------------------------------------------
. 2014-08-20 16:10:37.861 Using FTP protocol.
. 2014-08-20 16:10:37.861 Doing startup conversation with host.
> 2014-08-20 16:10:37.861 PWD
< 2014-08-20 16:10:37.877 257 "/YYYDATAHCM/HP1"
. 2014-08-20 16:10:37.892 Getting current directory name.
. 2014-08-20 16:10:37.892 Startup conversation with host finished.
< 2014-08-20 16:10:37.892 Script: Active session: [1] ftpbagjas-hp1@server77.YYY.ch
> 2014-08-20 16:10:37.892 Script: option batch abort
< 2014-08-20 16:10:37.892 Script: batch abort
> 2014-08-20 16:10:37.892 Script: option confirm off
< 2014-08-20 16:10:37.892 Script: confirm off
> 2014-08-20 16:10:37.892 Script: option transfer ascii
< 2014-08-20 16:10:37.892 Script: transfer ascii
> 2014-08-20 16:10:37.892 Script: get "92/SAPHR2PD_UPD_201408205.TXT.TRANSFER" "\\FilerXXX\YYY\in\"
. 2014-08-20 16:10:37.892 Listing file "92/SAPHR2PD_UPD_201408205.TXT.TRANSFER".
. 2014-08-20 16:10:37.892 Retrieving directory listing...
> 2014-08-20 16:10:37.892 CWD /YYYDATAHCM/HP1/92/
< 2014-08-20 16:10:37.892 250 Directory successfully changed.
> 2014-08-20 16:10:37.892 PWD
< 2014-08-20 16:10:37.908 257 "/YYYDATAHCM/HP1/92"
> 2014-08-20 16:10:37.908 TYPE A
< 2014-08-20 16:10:37.908 200 Switching to ASCII mode.
> 2014-08-20 16:10:37.908 PASV
< 2014-08-20 16:10:37.908 227 Entering Passive Mode (10,123,192,196,249,143)
> 2014-08-20 16:10:37.908 LIST -a
< 2014-08-20 16:10:37.924 150 Here comes the directory listing.
< 2014-08-20 16:10:37.924 226 Directory send OK.
. 2014-08-20 16:10:37.924 drwxrwxrwx 2 4000 4000 8192 Aug 20 13:55 .
. 2014-08-20 16:10:37.924 drwxrwxrwx 39 4001 4000 4096 Aug 15 07:49 ..
. 2014-08-20 16:10:37.924 -rw-r--r-- 1 4018 4000 17049480 Aug 03 22:36 PD2SAPHR_20140803.txt
. 2014-08-20 16:10:37.924 -rw-r--r-- 1 4018 4000 17054992 Aug 04 21:27 PD2SAPHR_20140804.txt
...
. 2014-08-20 16:10:37.924 -rwxrw-rw- 1 4008 4008 3680 Aug 03 07:26 SAPHR2PD_UPD_201408032.TXT.TRANSFER
. 2014-08-20 16:10:37.924 -rwxrw-rw- 1 4008 4008 136 Aug 03 09:25 SAPHR2PD_UPD_201408033.TXT.TRANSFER
...
. 2014-08-20 16:10:37.939 Directory listing successful
. 2014-08-20 16:10:37.939 SAPHR2PD_UPD_201408205.TXT.TRANSFER;-;118928;2014-08-20T10:26:00.000Z;"4008" [0];"4008" [0];rwxrw-rw-;1
. 2014-08-20 16:10:37.939 File: '/YYYDATAHCM/HP1/92/SAPHR2PD_UPD_201408205.TXT.TRANSFER' [2014-08-20T10:26:00.000Z] [118928]
. 2014-08-20 16:10:37.939 Copying "/YYYDATAHCM/HP1/92/SAPHR2PD_UPD_201408205.TXT.TRANSFER" to local directory started.
. 2014-08-20 16:10:37.939 Ascii transfer mode selected.
. 2014-08-20 16:10:37.939 Starting download of /YYYDATAHCM/HP1/92/SAPHR2PD_UPD_201408205.TXT.TRANSFER
> 2014-08-20 16:10:37.955 TYPE A
< 2014-08-20 16:10:37.955 200 Switching to ASCII mode.
> 2014-08-20 16:10:37.955 PASV
< 2014-08-20 16:10:37.955 227 Entering Passive Mode (10,123,192,196,77,93)
> 2014-08-20 16:10:37.971 RETR SAPHR2PD_UPD_201408205.TXT.TRANSFER
< 2014-08-20 16:10:37.971 150 Opening BINARY mode data connection for SAPHR2PD_UPD_201408205.TXT.TRANSFER (118928 bytes).
< 2014-08-20 16:10:38.002 226 File send OK.
. 2014-08-20 16:10:38.017 Download successful
> 2014-08-20 16:10:38.017 Script: exit
. 2014-08-20 16:10:38.017 Script: Exit code: 0