Copying files from remote side failed.
I'm trying to automate a download by calling WinSCP from a .NET executable. I can connect to the server, change directories and start the file get but I always get an error "Copying files from remote side failed."
If I run WinSCP and download the file manually, it works fine, so it's something with the script. I've tried changing the mode to bin, ascii, automatic with no luck.
Anyone have any ideas?
My call in the .net program looks like this:
Dim startInfo As New ProcessStartInfo("C:\Program Files\WinSCP\WinSCP.com", "/script=MyScript.txt /log=winscp.log")
Process.Start(startInfo)
The script (MyScript.txt), looks like this:
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch off
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
# Connect
open ftp://password:user@ftp1.ftpsite.com
# Change remote directory
cd titleswk
# Force binary mode transfer
option transfer automatic
# Download file
get ecpacat.txt c:\
# Disconnect
close
# Exit WinSCP
exit
log:
. 2009-02-28 10:29:20.453 --------------------------------------------------------------------------
. 2009-02-28 10:29:20.453 WinSCP Version 4.1.8 (Build 415) (OS 5.1.2600 Service Pack 2)
. 2009-02-28 10:29:20.453 Login time: Saturday, February 28, 2009 10:29:20 AM
. 2009-02-28 10:29:20.453 --------------------------------------------------------------------------
. 2009-02-28 10:29:20.453 Session name: user@ftp1.ftpsite.com
. 2009-02-28 10:29:20.453 Host name: ftp1.ftpsite.com (Port: 21)
. 2009-02-28 10:29:20.453 User name: user(Password: Yes, Key file: No)
. 2009-02-28 10:29:20.453 Tunnel: No
. 2009-02-28 10:29:20.453 Transfer Protocol: FTP
. 2009-02-28 10:29:20.453 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2009-02-28 10:29:20.453 Proxy: none
. 2009-02-28 10:29:20.453 FTP: Passive: No
. 2009-02-28 10:29:20.453 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2009-02-28 10:29:20.453 Cache directory changes: Yes, Permanent: Yes
. 2009-02-28 10:29:20.453 DST mode: 1
. 2009-02-28 10:29:20.453 --------------------------------------------------------------------------
. 2009-02-28 10:29:20.656 Connecting to ftp1.ftpsite.com ...
. 2009-02-28 10:29:21.687 Connected with ftp1.ftpsite.com. Waiting for welcome message...
< 2009-02-28 10:29:21.796 220 Serv-U FTP Server v6.3 for WinSock ready...
> 2009-02-28 10:29:21.796 USER user
< 2009-02-28 10:29:21.890 331 User name okay, need password.
> 2009-02-28 10:29:21.890 PASS *******
< 2009-02-28 10:29:22.000 230 User logged in, proceed.
> 2009-02-28 10:29:22.000 SYST
< 2009-02-28 10:29:22.078 215 UNIX Type: L8
> 2009-02-28 10:29:22.078 FEAT
< 2009-02-28 10:29:22.296 211-Extension supported
< 2009-02-28 10:29:22.453 AUTH TLS
< 2009-02-28 10:29:22.453 SSCN
< 2009-02-28 10:29:22.453 PBSZ
< 2009-02-28 10:29:22.453 PROT
< 2009-02-28 10:29:22.453 CCC
< 2009-02-28 10:29:22.453 CLNT
< 2009-02-28 10:29:22.453 MDTM
< 2009-02-28 10:29:22.453 MDTM YYYYMMDDHHMMSS[+-TZ];filename
< 2009-02-28 10:29:22.453 SIZE
< 2009-02-28 10:29:22.453 SITE PSWD;EXEC;SET;INDEX;ZONE;CHMOD;MSG
< 2009-02-28 10:29:22.453 REST STREAM
< 2009-02-28 10:29:22.453 XCRC filename;start;end
< 2009-02-28 10:29:22.453 MODE Z
< 2009-02-28 10:29:22.453 MLST Type*;Size*;Create;Modify*;Win32.ea*;
< 2009-02-28 10:29:22.453 211 End
. 2009-02-28 10:29:22.453 Connected
. 2009-02-28 10:29:22.453 --------------------------------------------------------------------------
. 2009-02-28 10:29:22.453 Using FTP protocol.
. 2009-02-28 10:29:22.468 Doing startup conversation with host.
> 2009-02-28 10:29:22.468 PWD
< 2009-02-28 10:29:22.562 257 "/d:/ftproot/titles" is current directory.
. 2009-02-28 10:29:22.578 Getting current directory name.
. 2009-02-28 10:29:22.578 Startup conversation with host finished.
. 2009-02-28 10:29:22.578 Cached directory change via "titleswk" to "/d:/ftproot/titles/titleswk".
. 2009-02-28 10:29:22.578 Getting current directory name.
. 2009-02-28 10:29:22.578 Listing file "ecpacat.txt".
. 2009-02-28 10:29:22.578 Retrieving directory listing...
> 2009-02-28 10:29:22.593 CWD /d:/ftproot/titles/titleswk/
< 2009-02-28 10:29:22.687 250 Directory changed to /d:/ftproot/titles/Titleswk
> 2009-02-28 10:29:22.687 PWD
< 2009-02-28 10:29:22.765 257 "/d:/ftproot/titles/Titleswk" is current directory.
> 2009-02-28 10:29:22.765 TYPE A
< 2009-02-28 10:29:22.828 200 Type set to A.
> 2009-02-28 10:29:22.828 PORT 192,168,1,5,8,129
< 2009-02-28 10:29:22.890 200 PORT Command successful.
> 2009-02-28 10:29:22.890 LIST -a
< 2009-02-28 10:29:23.078 150 Opening ASCII mode data connection for /bin/ls.
< 2009-02-28 10:29:24.328 226 Transfer complete.
. 2009-02-28 10:29:24.328 Directory listing successful
. 2009-02-28 10:29:24.328 File: "/d:/ftproot/titles/titleswk/ecpacat.txt"
. 2009-02-28 10:29:24.328 Copying "/d:/ftproot/titles/titleswk/ecpacat.txt" to local directory started.
. 2009-02-28 10:29:24.328 Ascii transfer mode selected.
. 2009-02-28 10:29:24.328 Starting download of /d:/ftproot/titles/titleswk/ecpacat.txt
> 2009-02-28 10:29:24.328 CWD /d:/ftproot/titles/titleswk/
< 2009-02-28 10:29:24.406 250 Directory changed to /d:/ftproot/titles/Titleswk
> 2009-02-28 10:29:24.406 PWD
< 2009-02-28 10:29:24.468 257 "/d:/ftproot/titles/Titleswk" is current directory.
. 2009-02-28 10:29:24.468 Copying files from remote side failed.
* 2009-02-28 10:29:24.468 (ExtException) Copying files from remote side failed.
* 2009-02-28 10:29:24.468 "/d:/ftproot/titles/Titleswk" is current directory.
. 2009-02-28 10:29:24.468 Asking user:
. 2009-02-28 10:29:24.468 Error transferring file '/d:/ftproot/titles/titleswk/ecpacat.txt'. ("Copying files from remote side failed.","""/d:/ftproot/titles/Titleswk"" is current directory.")
If I run WinSCP and download the file manually, it works fine, so it's something with the script. I've tried changing the mode to bin, ascii, automatic with no luck.
Anyone have any ideas?
My call in the .net program looks like this:
Dim startInfo As New ProcessStartInfo("C:\Program Files\WinSCP\WinSCP.com", "/script=MyScript.txt /log=winscp.log")
Process.Start(startInfo)
The script (MyScript.txt), looks like this:
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch off
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
# Connect
open ftp://password:user@ftp1.ftpsite.com
# Change remote directory
cd titleswk
# Force binary mode transfer
option transfer automatic
# Download file
get ecpacat.txt c:\
# Disconnect
close
# Exit WinSCP
exit
log:
. 2009-02-28 10:29:20.453 --------------------------------------------------------------------------
. 2009-02-28 10:29:20.453 WinSCP Version 4.1.8 (Build 415) (OS 5.1.2600 Service Pack 2)
. 2009-02-28 10:29:20.453 Login time: Saturday, February 28, 2009 10:29:20 AM
. 2009-02-28 10:29:20.453 --------------------------------------------------------------------------
. 2009-02-28 10:29:20.453 Session name: user@ftp1.ftpsite.com
. 2009-02-28 10:29:20.453 Host name: ftp1.ftpsite.com (Port: 21)
. 2009-02-28 10:29:20.453 User name: user(Password: Yes, Key file: No)
. 2009-02-28 10:29:20.453 Tunnel: No
. 2009-02-28 10:29:20.453 Transfer Protocol: FTP
. 2009-02-28 10:29:20.453 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2009-02-28 10:29:20.453 Proxy: none
. 2009-02-28 10:29:20.453 FTP: Passive: No
. 2009-02-28 10:29:20.453 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2009-02-28 10:29:20.453 Cache directory changes: Yes, Permanent: Yes
. 2009-02-28 10:29:20.453 DST mode: 1
. 2009-02-28 10:29:20.453 --------------------------------------------------------------------------
. 2009-02-28 10:29:20.656 Connecting to ftp1.ftpsite.com ...
. 2009-02-28 10:29:21.687 Connected with ftp1.ftpsite.com. Waiting for welcome message...
< 2009-02-28 10:29:21.796 220 Serv-U FTP Server v6.3 for WinSock ready...
> 2009-02-28 10:29:21.796 USER user
< 2009-02-28 10:29:21.890 331 User name okay, need password.
> 2009-02-28 10:29:21.890 PASS *******
< 2009-02-28 10:29:22.000 230 User logged in, proceed.
> 2009-02-28 10:29:22.000 SYST
< 2009-02-28 10:29:22.078 215 UNIX Type: L8
> 2009-02-28 10:29:22.078 FEAT
< 2009-02-28 10:29:22.296 211-Extension supported
< 2009-02-28 10:29:22.453 AUTH TLS
< 2009-02-28 10:29:22.453 SSCN
< 2009-02-28 10:29:22.453 PBSZ
< 2009-02-28 10:29:22.453 PROT
< 2009-02-28 10:29:22.453 CCC
< 2009-02-28 10:29:22.453 CLNT
< 2009-02-28 10:29:22.453 MDTM
< 2009-02-28 10:29:22.453 MDTM YYYYMMDDHHMMSS[+-TZ];filename
< 2009-02-28 10:29:22.453 SIZE
< 2009-02-28 10:29:22.453 SITE PSWD;EXEC;SET;INDEX;ZONE;CHMOD;MSG
< 2009-02-28 10:29:22.453 REST STREAM
< 2009-02-28 10:29:22.453 XCRC filename;start;end
< 2009-02-28 10:29:22.453 MODE Z
< 2009-02-28 10:29:22.453 MLST Type*;Size*;Create;Modify*;Win32.ea*;
< 2009-02-28 10:29:22.453 211 End
. 2009-02-28 10:29:22.453 Connected
. 2009-02-28 10:29:22.453 --------------------------------------------------------------------------
. 2009-02-28 10:29:22.453 Using FTP protocol.
. 2009-02-28 10:29:22.468 Doing startup conversation with host.
> 2009-02-28 10:29:22.468 PWD
< 2009-02-28 10:29:22.562 257 "/d:/ftproot/titles" is current directory.
. 2009-02-28 10:29:22.578 Getting current directory name.
. 2009-02-28 10:29:22.578 Startup conversation with host finished.
. 2009-02-28 10:29:22.578 Cached directory change via "titleswk" to "/d:/ftproot/titles/titleswk".
. 2009-02-28 10:29:22.578 Getting current directory name.
. 2009-02-28 10:29:22.578 Listing file "ecpacat.txt".
. 2009-02-28 10:29:22.578 Retrieving directory listing...
> 2009-02-28 10:29:22.593 CWD /d:/ftproot/titles/titleswk/
< 2009-02-28 10:29:22.687 250 Directory changed to /d:/ftproot/titles/Titleswk
> 2009-02-28 10:29:22.687 PWD
< 2009-02-28 10:29:22.765 257 "/d:/ftproot/titles/Titleswk" is current directory.
> 2009-02-28 10:29:22.765 TYPE A
< 2009-02-28 10:29:22.828 200 Type set to A.
> 2009-02-28 10:29:22.828 PORT 192,168,1,5,8,129
< 2009-02-28 10:29:22.890 200 PORT Command successful.
> 2009-02-28 10:29:22.890 LIST -a
< 2009-02-28 10:29:23.078 150 Opening ASCII mode data connection for /bin/ls.
< 2009-02-28 10:29:24.328 226 Transfer complete.
. 2009-02-28 10:29:24.328 Directory listing successful
. 2009-02-28 10:29:24.328 File: "/d:/ftproot/titles/titleswk/ecpacat.txt"
. 2009-02-28 10:29:24.328 Copying "/d:/ftproot/titles/titleswk/ecpacat.txt" to local directory started.
. 2009-02-28 10:29:24.328 Ascii transfer mode selected.
. 2009-02-28 10:29:24.328 Starting download of /d:/ftproot/titles/titleswk/ecpacat.txt
> 2009-02-28 10:29:24.328 CWD /d:/ftproot/titles/titleswk/
< 2009-02-28 10:29:24.406 250 Directory changed to /d:/ftproot/titles/Titleswk
> 2009-02-28 10:29:24.406 PWD
< 2009-02-28 10:29:24.468 257 "/d:/ftproot/titles/Titleswk" is current directory.
. 2009-02-28 10:29:24.468 Copying files from remote side failed.
* 2009-02-28 10:29:24.468 (ExtException) Copying files from remote side failed.
* 2009-02-28 10:29:24.468 "/d:/ftproot/titles/Titleswk" is current directory.
. 2009-02-28 10:29:24.468 Asking user:
. 2009-02-28 10:29:24.468 Error transferring file '/d:/ftproot/titles/titleswk/ecpacat.txt'. ("Copying files from remote side failed.","""/d:/ftproot/titles/Titleswk"" is current directory.")