Re: Script can't find certain files
get -nopreservetime *-International-*.* C:\Documents and settings\
Should be (note the quotes):
get -nopreservetime *-International-*.* "C:\Documents and settings\"
See https://winscp.net/eng/docs/scripting#quotes
get -nopreservetime *-International-*.* C:\Documents and settings\
get -nopreservetime *-International-*.* "C:\Documents and settings\"
C:\Document And Settings), but I am below error.
Can't get attributes of file 'C:\Documents'.
No such file or directory.
Error code: 2
Error message from server: No such file
Request code: 7
Private Function WinSCPDownload() As Boolean
Try
If (Login()) Then
With WinSCP.StandardInput
.WriteLine("cd /data/test/out")
.WriteLine("ls *-International-*.xml")
.WriteLine("get -nopreservetime *-International-*.* C:\Documents and settings\")
.Close()
End With
End If
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
End Function
winscp> cd /data/test/out
/data/test/out
winscp> ls *-International-*.xml
winscp> get -nopreservetime *-International-*.* C:\Documents and settings\
Can't get attributes of file 'C:\Documents'.
No such file or directory.
Error code: 2
Error message from server: No such file
Request code: 7
The program '[2628] WindowsApplicationJK.exe' has exited with code 0 (0x0).
.PGP, while you download .PHP in the script.
. 2010-03-29 10:10:17.868 Copying 1 files/directories to remote directory "/htdocs/equimax/home/"
. 2010-03-29 10:10:17.878 PrTime: Yes; PrRO: Yes; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: Yes; Mask: *.*
. 2010-03-29 10:10:17.878 TM: M; ClAr: No; CPS: 0; ExclM(No):
. 2010-03-29 10:10:17.878 AscM: *.*html; *.htm; *.txt; *.php*; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-03-29 10:10:17.878 File: "C:\netfiles\weblists\CANDS_D.PGP"
. 2010-03-29 10:10:18.258 Copying "C:\netfiles\weblists\CANDS_D.PGP" to remote directory started.
. 2010-03-29 10:10:18.278 Binary transfer mode selected.
. 2010-03-29 10:10:18.288 Checking existence of file.
> 2010-03-29 10:10:18.288 Type: SSH_FXP_LSTAT, Size: 41, Number: 1543
< 2010-03-29 10:10:18.288 Type: SSH_FXP_STATUS, Size: 24, Number: 1284
. 2010-03-29 10:10:18.288 Discarding reserved response
< 2010-03-29 10:10:18.358 Type: SSH_FXP_STATUS, Size: 29, Number: 1543
< 2010-03-29 10:10:18.358 Status code: 2
. 2010-03-29 10:10:18.358 Checking existence of partially transfered file.
> 2010-03-29 10:10:18.358 Type: SSH_FXP_LSTAT, Size: 50, Number: 1799
< 2010-03-29 10:10:18.419 Type: SSH_FXP_STATUS, Size: 29, Number: 1799
< 2010-03-29 10:10:18.419 Status code: 2
. 2010-03-29 10:10:18.419 Opening remote file.
> 2010-03-29 10:10:18.419 Type: SSH_FXP_OPEN, Size: 66, Number: 2051
< 2010-03-29 10:10:18.509 Type: SSH_FXP_HANDLE, Size: 13, Number: 2051
> 2010-03-29 10:10:18.639 Type: SSH_FXP_WRITE, Size: 4121, Number: 2566
. 2010-03-29 10:10:50.675 82 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2010-03-29 10:10:50.685 Type: SSH_FXP_CLOSE, Size: 13, Number: 13572
< 2010-03-29 10:10:50.695 Type: SSH_FXP_STATUS, Size: 24, Number: 12806
< 2010-03-29 10:10:52.267 Type: SSH_FXP_STATUS, Size: 24, Number: 13062
< 2010-03-29 10:10:52.387 Type: SSH_FXP_STATUS, Size: 24, Number: 13318
< 2010-03-29 10:10:52.387 Type: SSH_FXP_STATUS, Size: 24, Number: 13572
< 2010-03-29 10:10:52.387 Status code: 0
> 2010-03-29 10:10:52.457 Type: SSH_FXP_RENAME, Size: 86, Number: 13842
< 2010-03-29 10:10:52.528 Type: SSH_FXP_STATUS, Size: 24, Number: 13842
< 2010-03-29 10:10:52.528 Status code: 0
> 2010-03-29 10:10:52.528 Type: SSH_FXP_SETSTAT, Size: 53, Number: 2313
< 2010-03-29 10:10:52.598 Type: SSH_FXP_STATUS, Size: 24, Number: 2313
< 2010-03-29 10:10:52.808 Status code: 0
. 2010-03-29 10:10:52.828 Listing directory "/htdocs/equimax/home".
> 2010-03-29 10:10:52.828 Type: SSH_FXP_OPENDIR, Size: 29, Number: 14091
< 2010-03-29 10:10:52.888 Type: SSH_FXP_HANDLE, Size: 13, Number: 14091
> 2010-03-29 10:10:52.888 Type: SSH_FXP_READDIR, Size: 13, Number: 14348
< 2010-03-29 10:10:52.958 Type: SSH_FXP_NAME, Size: 573, Number: 14348
> 2010-03-29 10:10:52.958 Type: SSH_FXP_READDIR, Size: 13, Number: 14604
< 2010-03-29 10:10:53.058 Type: SSH_FXP_STATUS, Size: 28, Number: 14604
< 2010-03-29 10:10:53.229 Status code: 1
> 2010-03-29 10:10:53.229 Type: SSH_FXP_CLOSE, Size: 13, Number: 14852
. 2010-03-29 10:28:19.483 --------------------------------------------------------------------------
. 2010-03-29 10:28:19.483 WinSCP Version 4.2.7 (Build 758) (OS 5.1.2600 Service Pack 3)
. 2010-03-29 10:28:19.483 Login time: Monday, March 29, 2010 10:28:19 AM
. 2010-03-29 10:28:19.483 --------------------------------------------------------------------------
. 2010-03-29 10:28:19.483 Session name: equimax@equimax.com
. 2010-03-29 10:28:19.483 Host name: equimax.com (Port: 13140)
. 2010-03-29 10:28:19.483 User name: equimax (Password: Yes, Key file: No)
. 2010-03-29 10:28:19.533 Tunnel: No
. 2010-03-29 10:28:19.533 Transfer Protocol: SFTP (SCP)
. 2010-03-29 10:28:19.533 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2010-03-29 10:28:19.533 Proxy: none
. 2010-03-29 10:28:19.533 SSH protocol version: 2; Compression: No
. 2010-03-29 10:28:19.533 Bypass authentication: No
. 2010-03-29 10:28:19.533 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2010-03-29 10:28:19.533 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2010-03-29 10:28:19.533 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2010-03-29 10:28:19.533 SFTP Bugs: -,-
. 2010-03-29 10:28:19.533 Return code variable: Autodetect; Lookup user groups: Yes
. 2010-03-29 10:28:19.533 Shell: default, EOL: 0
. 2010-03-29 10:28:19.533 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2010-03-29 10:28:19.533 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2010-03-29 10:28:19.533 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-03-29 10:28:19.533 Cache directory changes: Yes, Permanent: Yes
. 2010-03-29 10:28:19.533 DST mode: 1
. 2010-03-29 10:28:19.533 --------------------------------------------------------------------------
. 2010-03-29 10:28:19.533 Looking up host "equimax.com"
. 2010-03-29 10:28:19.813 Connecting to 69.93.63.14 port 13140
. 2010-03-29 10:28:20.094 Server version: SSH-2.0-OpenSSH_5.2
. 2010-03-29 10:28:20.094 Using SSH protocol version 2
. 2010-03-29 10:28:20.094 We claim version: SSH-2.0-WinSCP_release_4.2.7
. 2010-03-29 10:28:20.164 Doing Diffie-Hellman group exchange
. 2010-03-29 10:28:20.314 Doing Diffie-Hellman key exchange with hash SHA-1
. 2010-03-29 10:28:20.825 Host key fingerprint is:
. 2010-03-29 10:28:20.825 ssh-rsa 1024 ac:6d:be:2d:0c:2a:b2:a3:a4:73:c4:42:f6:77:e5:ec
. 2010-03-29 10:28:20.835 Initialised AES-256 SDCTR client->server encryption
. 2010-03-29 10:28:20.835 Initialised HMAC-SHA1 client->server MAC algorithm
. 2010-03-29 10:28:20.835 Initialised AES-256 SDCTR server->client encryption
. 2010-03-29 10:28:20.835 Initialised HMAC-SHA1 server->client MAC algorithm
! 2010-03-29 10:28:20.965 Using username "equimax".
. 2010-03-29 10:28:21.165 Prompt (6, SSH password, , &Password: )
. 2010-03-29 10:28:21.165 Using stored password.
. 2010-03-29 10:28:21.175 Sent password
. 2010-03-29 10:28:21.616 Access granted
. 2010-03-29 10:28:21.676 Opened channel for session
. 2010-03-29 10:28:21.826 Started a shell/command
. 2010-03-29 10:28:21.836 --------------------------------------------------------------------------
. 2010-03-29 10:28:21.836 Using SFTP protocol.
. 2010-03-29 10:28:21.836 Doing startup conversation with host.
> 2010-03-29 10:28:21.836 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2010-03-29 10:28:21.896 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2010-03-29 10:28:21.896 SFTP version 3 negotiated.
. 2010-03-29 10:28:21.896 We believe the server has signed timestamps bug
. 2010-03-29 10:28:21.896 We will use UTF-8 strings for status messages only
. 2010-03-29 10:28:21.896 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2010-03-29 10:28:21.906 Getting current directory name.
. 2010-03-29 10:28:21.906 Getting real path for '.'
> 2010-03-29 10:28:21.906 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2010-03-29 10:28:21.957 Type: SSH_FXP_NAME, Size: 47, Number: 16
. 2010-03-29 10:28:21.957 Real path is '/home/equimax'
. 2010-03-29 10:28:21.957 Startup conversation with host finished.
. 2010-03-29 10:28:21.967 Cached directory change via "/htdocs/equimax/home" to "/htdocs/equimax/home".
. 2010-03-29 10:28:21.967 Getting current directory name.
. 2010-03-29 10:28:21.997 Copying 1 files/directories to remote directory "/htdocs/equimax/home"
. 2010-03-29 10:28:21.997 PrTime: Yes; PrRO: Yes; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask:
. 2010-03-29 10:28:21.997 TM: B; ClAr: No; CPS: 0; ExclM(No):
. 2010-03-29 10:28:21.997 AscM: *.*html; *.htm; *.txt; *.php*; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-03-29 10:28:21.997 File: "c:\netfiles\weblists\CANDS_D.PHP"
* 2010-03-29 10:28:21.997 (EOSError) System Error. Code: 2.
* 2010-03-29 10:28:21.997 The system cannot find the file specified
. 2010-03-29 10:28:21.997 Asking user:
. 2010-03-29 10:28:21.997 File or folder 'c:\netfiles\weblists\CANDS_D.PHP' does not exist. ("System Error. Code: 2.
. 2010-03-29 10:28:21.997 The system cannot find the file specified")
* 2010-03-29 10:28:22.027 (EScpSkipFile) File or folder 'c:\netfiles\weblists\CANDS_D.PHP' does not exist.
* 2010-03-29 10:28:22.027 System Error. Code: 2.
* 2010-03-29 10:28:22.027 The system cannot find the file specified
. 2010-03-29 10:28:22.047 Closing connection.
. 2010-03-29 10:28:22.047 Sending special code: 12
. 2010-03-29 10:28:22.047 Sent EOF message
3.png | 4 KiB | 6.7 KiB/s | binary | 100%
4.png | 0 KiB | 3.2 KiB/s | binary | 0%
Error transferring file '/folder2/folder.loc/web/4.png'.
Copying files from remote side failed.
Can't open data connection.
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
Session 'test' closed.
No session.
weblists.bat) with password removed for security:
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
open equimax:password@equimax.com
# Change remote directory
cd /htdocs/equimax/home
# Force binary mode transfer
option transfer binary
# Upload file to the remote directory
put c:\netfiles\weblists\weblists.zip
put c:\netfiles\weblists\C_LIST_D.php
put c:\netfiles\weblists\CANDS_D.PHP
put c:\netfiles\weblists\CLIENTS_D.PHP
put c:\netfiles\weblists\J_LIST_D.PHP
put c:\netfiles\weblists\JLSUB_D.PHP
put c:\netfiles\weblists\JOBS_D.PHP
put c:\netfiles\weblists\LISTCAND_D.PHP
put c:\netfiles\weblists\RECTS_D.PHP
put c:\netfiles\weblists\empnojob.txt
# Disconnect
close
# Exit WinSCP
exit
"c:\program files\winscp3\winscp.com" /script=c:\netfiles\scpscripts\weblists.txt
weblists.zip and empnojob.txt transfer just fine. The others cannot be found. Here are the results as shown in the command window:
C:\Documents and Settings\Seth>"c:\program files\winscp3\winscp.com" /script=c
netfiles\scpscripts\weblists.txt
batch on
confirm off
Searching for host...
Connecting to host...
Authenticating...
Using username "equimax".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] equimax@equimax.com
/htdocs/equimax/home
transfer binary
c:\...\WEBLISTS.ZIP | 219 KiB | 37.6 KiB/s | binary | 100%
File or folder 'c:\netfiles\weblists\C_LIST_D.php' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
File or folder 'c:\netfiles\weblists\CANDS_D.PHP' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
File or folder 'c:\netfiles\weblists\CLIENTS_D.PHP' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
File or folder 'c:\netfiles\weblists\J_LIST_D.PHP' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
File or folder 'c:\netfiles\weblists\JLSUB_D.PHP' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
File or folder 'c:\netfiles\weblists\JOBS_D.PHP' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
File or folder 'c:\netfiles\weblists\LISTCAND_D.PHP' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
File or folder 'c:\netfiles\weblists\RECTS_D.PHP' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
c:\...\empnojob.txt | 0 KiB | 0.0 KiB/s | binary | 100%
Session 'equimax@equimax.com' closed.
No session.