exit code 1 on script
I am trying to execute a script which results in a successful connection and transfer, but returns an error code of 1.
Here is the script-
open ftp://ftpuser:password@ftp.domain.net
option batch abort
option confirm off
put \\domain.net\common\share\IT_Operations\ftptest\*.txt
exit
And here is the console output-
Connecting to ftp.domain.net ...
Connected with ftp.domain.net. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] ftpuser@ftp.domain.net
batch abort
confirm off
\\domain.net\common\share\IT_Operations\ftptest\foo.txt | 0 KiB | 0.0 KiB/s | ascii | 0%
And here is the log-
. 2012-05-18 16:57:26.756 --------------------------------------------------------------------------
. 2012-05-18 16:57:26.756 WinSCP Version 5.0.7 (Build 2268) (OS 6.1.7601 Service Pack 1)
. 2012-05-18 16:57:26.756 Configuration: C:\Program Files (x86)\WinSCP\WinSCP.ini
. 2012-05-18 16:57:26.757 Local account: xxxxx
. 2012-05-18 16:57:26.757 Login time: Friday, May 18, 2012 4:57:26 PM
. 2012-05-18 16:57:26.757 --------------------------------------------------------------------------
. 2012-05-18 16:57:26.757 Session name: ftpuser@ftp.domain.net (Ad-Hoc session)
. 2012-05-18 16:57:26.757 Host name: ftp.domain.net (Port: 21)
. 2012-05-18 16:57:26.757 User name: ftpuser (Password: Yes, Key file: No)
. 2012-05-18 16:57:26.757 Tunnel: No
. 2012-05-18 16:57:26.757 Transfer Protocol: FTP
. 2012-05-18 16:57:26.757 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2012-05-18 16:57:26.757 Proxy: none
. 2012-05-18 16:57:26.757 FTP: FTPS: None; Passive: Yes [Force IP: No]
. 2012-05-18 16:57:26.757 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2012-05-18 16:57:26.757 Cache directory changes: Yes, Permanent: Yes
. 2012-05-18 16:57:26.757 DST mode: 1
. 2012-05-18 16:57:26.757 --------------------------------------------------------------------------
. 2012-05-18 16:57:26.764 Connecting to ftp.domain.net ...
. 2012-05-18 16:57:26.767 Connected with ftp.domain.net. Waiting for welcome message...
< 2012-05-18 16:57:26.767 220 Microsoft FTP Service
> 2012-05-18 16:57:26.767 USER ftpuser
< 2012-05-18 16:57:26.768 331 Password required for ftpuser.
> 2012-05-18 16:57:26.768 PASS *********
< 2012-05-18 16:57:26.769 230 User ftpuser logged in.
> 2012-05-18 16:57:26.769 SYST
< 2012-05-18 16:57:26.769 215 Windows_NT
> 2012-05-18 16:57:26.769 FEAT
< 2012-05-18 16:57:26.771 211-FEAT
< 2012-05-18 16:57:26.968 SIZE
< 2012-05-18 16:57:26.968 MDTM
< 2012-05-18 16:57:26.968 211 END
. 2012-05-18 16:57:26.971 Connected
. 2012-05-18 16:57:26.971 --------------------------------------------------------------------------
. 2012-05-18 16:57:26.971 Using FTP protocol.
. 2012-05-18 16:57:26.972 Doing startup conversation with host.
> 2012-05-18 16:57:26.972 PWD
< 2012-05-18 16:57:26.973 257 "/ftpuser" is current directory.
. 2012-05-18 16:57:26.974 Getting current directory name.
. 2012-05-18 16:57:26.974 Startup conversation with host finished.
< 2012-05-18 16:57:26.975 Script: Active session: [1] ftpuser@ftp.domain.net
> 2012-05-18 16:57:26.975 Script: option batch abort
< 2012-05-18 16:57:26.976 Script: batch abort
> 2012-05-18 16:57:26.976 Script: option confirm off
< 2012-05-18 16:57:26.976 Script: confirm off
> 2012-05-18 16:57:26.977 Script: put \\domain.net\common\share\IT_Operations\ftptest\*.txt
. 2012-05-18 16:57:26.978 Copying 1 files/directories to remote directory "/ftpuser"
. 2012-05-18 16:57:26.978 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2012-05-18 16:57:26.978 TM: M; ClAr: No; CPS: 0; InclM:
. 2012-05-18 16:57:26.978 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2012-05-18 16:57:26.978 File: "\\domain.net\common\share\IT_Operations\ftptest\foo.txt"
. 2012-05-18 16:57:26.980 Copying "\\domain.net\common\share\IT_Operations\ftptest\foo.txt" to remote directory started.
. 2012-05-18 16:57:26.981 Ascii transfer mode selected.
. 2012-05-18 16:57:26.981 Starting upload of \\domain.net\common\share\IT_Operations\ftptest\foo.txt
> 2012-05-18 16:57:26.981 TYPE A
< 2012-05-18 16:57:26.981 200 Type set to A.
> 2012-05-18 16:57:26.981 PASV
< 2012-05-18 16:57:26.982 227 Entering Passive Mode (10,95,201,21,19,75).
> 2012-05-18 16:57:26.983 LIST
< 2012-05-18 16:57:26.984 125 Data connection already open; Transfer starting.
< 2012-05-18 16:57:27.188 226 Transfer complete.
> 2012-05-18 16:57:27.195 TYPE A
< 2012-05-18 16:57:27.196 200 Type set to A.
> 2012-05-18 16:57:27.196 PASV
< 2012-05-18 16:57:27.197 227 Entering Passive Mode (10,95,201,21,19,76).
> 2012-05-18 16:57:27.199 STOR foo.txt
< 2012-05-18 16:57:27.200 125 Data connection already open; Transfer starting.
< 2012-05-18 16:57:27.398 226 Transfer complete.
. 2012-05-18 16:57:27.398 Upload successful
> 2012-05-18 16:57:27.398 Script: exit
. 2012-05-18 16:57:27.401 Disconnected from server
Any idea why I am getting exit code 1 as opposed to exit code 0? This batch script is part of a larger powershell script with conditional actions firing on non-0 exit code, so I am eager to resolve this. Please let me know if there are any suggestions. In addition to trying this with version 5.0.7, I have also tried 4.3.7.
Here is the script-
open ftp://ftpuser:password@ftp.domain.net
option batch abort
option confirm off
put \\domain.net\common\share\IT_Operations\ftptest\*.txt
exit
And here is the console output-
Connecting to ftp.domain.net ...
Connected with ftp.domain.net. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] ftpuser@ftp.domain.net
batch abort
confirm off
\\domain.net\common\share\IT_Operations\ftptest\foo.txt | 0 KiB | 0.0 KiB/s | ascii | 0%
And here is the log-
. 2012-05-18 16:57:26.756 --------------------------------------------------------------------------
. 2012-05-18 16:57:26.756 WinSCP Version 5.0.7 (Build 2268) (OS 6.1.7601 Service Pack 1)
. 2012-05-18 16:57:26.756 Configuration: C:\Program Files (x86)\WinSCP\WinSCP.ini
. 2012-05-18 16:57:26.757 Local account: xxxxx
. 2012-05-18 16:57:26.757 Login time: Friday, May 18, 2012 4:57:26 PM
. 2012-05-18 16:57:26.757 --------------------------------------------------------------------------
. 2012-05-18 16:57:26.757 Session name: ftpuser@ftp.domain.net (Ad-Hoc session)
. 2012-05-18 16:57:26.757 Host name: ftp.domain.net (Port: 21)
. 2012-05-18 16:57:26.757 User name: ftpuser (Password: Yes, Key file: No)
. 2012-05-18 16:57:26.757 Tunnel: No
. 2012-05-18 16:57:26.757 Transfer Protocol: FTP
. 2012-05-18 16:57:26.757 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2012-05-18 16:57:26.757 Proxy: none
. 2012-05-18 16:57:26.757 FTP: FTPS: None; Passive: Yes [Force IP: No]
. 2012-05-18 16:57:26.757 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2012-05-18 16:57:26.757 Cache directory changes: Yes, Permanent: Yes
. 2012-05-18 16:57:26.757 DST mode: 1
. 2012-05-18 16:57:26.757 --------------------------------------------------------------------------
. 2012-05-18 16:57:26.764 Connecting to ftp.domain.net ...
. 2012-05-18 16:57:26.767 Connected with ftp.domain.net. Waiting for welcome message...
< 2012-05-18 16:57:26.767 220 Microsoft FTP Service
> 2012-05-18 16:57:26.767 USER ftpuser
< 2012-05-18 16:57:26.768 331 Password required for ftpuser.
> 2012-05-18 16:57:26.768 PASS *********
< 2012-05-18 16:57:26.769 230 User ftpuser logged in.
> 2012-05-18 16:57:26.769 SYST
< 2012-05-18 16:57:26.769 215 Windows_NT
> 2012-05-18 16:57:26.769 FEAT
< 2012-05-18 16:57:26.771 211-FEAT
< 2012-05-18 16:57:26.968 SIZE
< 2012-05-18 16:57:26.968 MDTM
< 2012-05-18 16:57:26.968 211 END
. 2012-05-18 16:57:26.971 Connected
. 2012-05-18 16:57:26.971 --------------------------------------------------------------------------
. 2012-05-18 16:57:26.971 Using FTP protocol.
. 2012-05-18 16:57:26.972 Doing startup conversation with host.
> 2012-05-18 16:57:26.972 PWD
< 2012-05-18 16:57:26.973 257 "/ftpuser" is current directory.
. 2012-05-18 16:57:26.974 Getting current directory name.
. 2012-05-18 16:57:26.974 Startup conversation with host finished.
< 2012-05-18 16:57:26.975 Script: Active session: [1] ftpuser@ftp.domain.net
> 2012-05-18 16:57:26.975 Script: option batch abort
< 2012-05-18 16:57:26.976 Script: batch abort
> 2012-05-18 16:57:26.976 Script: option confirm off
< 2012-05-18 16:57:26.976 Script: confirm off
> 2012-05-18 16:57:26.977 Script: put \\domain.net\common\share\IT_Operations\ftptest\*.txt
. 2012-05-18 16:57:26.978 Copying 1 files/directories to remote directory "/ftpuser"
. 2012-05-18 16:57:26.978 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2012-05-18 16:57:26.978 TM: M; ClAr: No; CPS: 0; InclM:
. 2012-05-18 16:57:26.978 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2012-05-18 16:57:26.978 File: "\\domain.net\common\share\IT_Operations\ftptest\foo.txt"
. 2012-05-18 16:57:26.980 Copying "\\domain.net\common\share\IT_Operations\ftptest\foo.txt" to remote directory started.
. 2012-05-18 16:57:26.981 Ascii transfer mode selected.
. 2012-05-18 16:57:26.981 Starting upload of \\domain.net\common\share\IT_Operations\ftptest\foo.txt
> 2012-05-18 16:57:26.981 TYPE A
< 2012-05-18 16:57:26.981 200 Type set to A.
> 2012-05-18 16:57:26.981 PASV
< 2012-05-18 16:57:26.982 227 Entering Passive Mode (10,95,201,21,19,75).
> 2012-05-18 16:57:26.983 LIST
< 2012-05-18 16:57:26.984 125 Data connection already open; Transfer starting.
< 2012-05-18 16:57:27.188 226 Transfer complete.
> 2012-05-18 16:57:27.195 TYPE A
< 2012-05-18 16:57:27.196 200 Type set to A.
> 2012-05-18 16:57:27.196 PASV
< 2012-05-18 16:57:27.197 227 Entering Passive Mode (10,95,201,21,19,76).
> 2012-05-18 16:57:27.199 STOR foo.txt
< 2012-05-18 16:57:27.200 125 Data connection already open; Transfer starting.
< 2012-05-18 16:57:27.398 226 Transfer complete.
. 2012-05-18 16:57:27.398 Upload successful
> 2012-05-18 16:57:27.398 Script: exit
. 2012-05-18 16:57:27.401 Disconnected from server
Any idea why I am getting exit code 1 as opposed to exit code 0? This batch script is part of a larger powershell script with conditional actions firing on non-0 exit code, so I am eager to resolve this. Please let me know if there are any suggestions. In addition to trying this with version 5.0.7, I have also tried 4.3.7.