Post a reply

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

Guest

Re: Script not getting all files using the get command

Anonymous wrote:

martin wrote:

I cannot tell without a full log file, so I can only assume that those 3 files did not exist when the get was called, but existed already when the rm was called.

Use get -delete instead of get and rm.
https://winscp.net/eng/docs/scriptcommand_get#delete


Thanks Martin, thanks for the reply. Here is the full log from the session

****************************************************************************************************************************************************
. 2016-07-15 16:45:00.636 --------------------------------------------------------------------------
. 2016-07-15 16:45:00.636 WinSCP Version 5.7.5 (Build 5665) (OS 6.2.9200 - Windows Server 2012 Datacenter)
. 2016-07-15 16:45:00.636 Configuration: C:\Users\myusername\AppData\Roaming\WinSCP.ini
. 2016-07-15 16:45:00.636 Log level: Normal
. 2016-07-15 16:45:00.636 Local account: mycompany\myusername
. 2016-07-15 16:45:00.636 Working directory: C:\Windows\system32
. 2016-07-15 16:45:00.636 Process ID: 12632
. 2016-07-15 16:45:00.636 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=575 /consoleinstance=_6264_681 "/script=c:\temp\script.txt"
. 2016-07-15 16:45:00.636 Time zone: Current: GMT+10, Standard: GMT+10 (AUS Eastern Standard Time), DST: GMT+11 (AUS Eastern Daylight Time), DST Start: 2/10/2016, DST End: 3/04/2016
. 2016-07-15 16:45:00.636 Login time: Friday, 15 July 2016 4:45:00 PM
. 2016-07-15 16:45:00.636 --------------------------------------------------------------------------
. 2016-07-15 16:45:00.636 Script: Retrospectively logging previous script records:
> 2016-07-15 16:45:00.636 Script: open mycompany.com -hostkey="ssh-rsa 2048 **** **** **** **** **** **** **** ****"
. 2016-07-15 16:45:00.636 --------------------------------------------------------------------------
. 2016-07-15 16:45:00.636 Session name: myserver.com (Ad-Hoc site)
. 2016-07-15 16:45:00.636 Host name: myserver.mycompany.com(Port: 22)
. 2016-07-15 16:45:00.636 User name: myusername (Password: Yes, Key file: No)
. 2016-07-15 16:45:00.636 Tunnel: No
. 2016-07-15 16:45:00.636 Transfer Protocol: SFTP (SCP)
. 2016-07-15 16:45:00.636 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2016-07-15 16:45:00.636 Disable Nagle: No
. 2016-07-15 16:45:00.636 Proxy: none
. 2016-07-15 16:45:00.636 Send buffer: 262144
. 2016-07-15 16:45:00.636 SSH protocol version: 2; Compression: No
. 2016-07-15 16:45:00.636 Bypass authentication: No
. 2016-07-15 16:45:00.636 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2016-07-15 16:45:00.636 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2016-07-15 16:45:00.636 KEX: dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN
. 2016-07-15 16:45:00.636 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A,A
. 2016-07-15 16:45:00.636 Simple channel: Yes
. 2016-07-15 16:45:00.636 Return code variable: Autodetect; Lookup user groups: A
. 2016-07-15 16:45:00.636 Shell: default
. 2016-07-15 16:45:00.636 EOL: 0, UTF: 2
. 2016-07-15 16:45:00.636 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2016-07-15 16:45:00.636 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2016-07-15 16:45:00.636 SFTP Bugs: A,A
. 2016-07-15 16:45:00.636 SFTP Server: default
. 2016-07-15 16:45:00.636 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2016-07-15 16:45:00.636 Cache directory changes: Yes, Permanent: Yes
. 2016-07-15 16:45:00.636 DST mode: 1
. 2016-07-15 16:45:00.636 --------------------------------------------------------------------------
. 2016-07-15 16:45:00.651 Looking up host "myserver.mycompany.com"
. 2016-07-15 16:45:00.838 Connecting to 1.1.1.1.1 port 22
. 2016-07-15 16:45:01.150 Server version: SSH-2.0-mod_sftp/0.9.9
. 2016-07-15 16:45:01.150 Using SSH protocol version 2
. 2016-07-15 16:45:01.150 We claim version: SSH-2.0-WinSCP_release_5.7.5
. 2016-07-15 16:45:01.150 Doing Diffie-Hellman group exchange
. 2016-07-15 16:45:01.556 Doing Diffie-Hellman key exchange with hash SHA-256
. 2016-07-15 16:45:03.210 Verifying host key rsa2 0x23,0xd4418d9ae0a5639d 40957e75ee2bf0d0 7f9d10187e807226 7ff2999897f10926 fe1e1f64a112e40e 7bbbe68d53cfaf08 793910cc89fe09d1 83170e55cbcfe982 236edea364b5b8ed ddc3d60e8e629034 cc59d7ea980efa1d e18b8a26dcc61bc0 f7be1046cd7067ec fb355f42afb4ae69 cdcce681c83be3e9 8747dc45b27abb04 53fb9afc0edadf03 04ffadd321328be4 25a616a5439d6545 f4dd9a6116652c20 3d640feea1c0e4a2 e6d74f0c321d7d8a 1c5b90e9a9d3ee47 744ffa076c03e8d4 c279cb6723619da4 070ca4ee39f786bf d2353cd62b93ead7 ad1457f62c11ff2f a1e3410339841543 863da043657eeb52 3e1ef8591a978148 108d02262e1822f9 with fingerprint ssh-rsa 2048 30:93:f8:cc:dc:44:27:38:b3:e8:c5:4a:fc:3d:cf:c1
. 2016-07-15 16:45:03.210 Host key matches cached key
. 2016-07-15 16:45:03.210 Host key fingerprint is:
. 2016-07-15 16:45:03.210 ssh-rsa 2048 30:93:f8:cc:dc:44:27:38:b3:e8:c5:4a:fc:3d:cf:c1
. 2016-07-15 16:45:03.210 Initialised AES-256 SDCTR client->server encryption
. 2016-07-15 16:45:03.210 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2016-07-15 16:45:03.210 Initialised AES-256 SDCTR server->client encryption
. 2016-07-15 16:45:03.210 Initialised HMAC-SHA-256 server->client MAC algorithm
! 2016-07-15 16:45:03.615 Using username "myusername".
. 2016-07-15 16:45:03.756 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2016-07-15 16:45:03.756 Using stored password.
. 2016-07-15 16:45:03.771 Sent password
. 2016-07-15 16:45:03.927 Access granted
. 2016-07-15 16:45:03.927 Opening session as main channel
. 2016-07-15 16:45:04.083 Opened main channel
. 2016-07-15 16:45:04.473 Started a shell/command
. 2016-07-15 16:45:04.473 --------------------------------------------------------------------------
. 2016-07-15 16:45:04.473 Using SFTP protocol.
. 2016-07-15 16:45:04.489 Doing startup conversation with host.
> 2016-07-15 16:45:04.489 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2016-07-15 16:45:04.629 Type: SSH_FXP_VERSION, Size: 138, Number: -1
. 2016-07-15 16:45:04.629 SFTP version 3 negotiated.
. 2016-07-15 16:45:04.629 SFTP versions supported by the server: 3
. 2016-07-15 16:45:04.629 Unknown server extension fsync@openssh.com="1"
. 2016-07-15 16:45:04.629 Unknown server extension posix-rename@openssh.com="1"
. 2016-07-15 16:45:04.629 Supports statvfs@openssh.com extension version "2"
. 2016-07-15 16:45:04.629 Unknown server extension fstatvfs@openssh.com="2"
. 2016-07-15 16:45:04.629 We believe the server has signed timestamps bug
. 2016-07-15 16:45:04.629 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 string are not mandatory
. 2016-07-15 16:45:04.629 Getting current directory name.
. 2016-07-15 16:45:04.629 Getting real path for '.'
> 2016-07-15 16:45:04.629 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2016-07-15 16:45:04.785 Type: SSH_FXP_NAME, Size: 113, Number: 16
. 2016-07-15 16:45:04.785 Real path is '/'
. 2016-07-15 16:45:04.785 Startup conversation with host finished.
< 2016-07-15 16:45:04.785 Script: Active session: [1] myusername@myserver.mycompany.com
> 2016-07-15 16:45:04.785 Script: cd "directory567"
. 2016-07-15 16:45:04.785 Cached directory change via "directory567" to "/directory567".
. 2016-07-15 16:45:04.785 Getting current directory name.
< 2016-07-15 16:45:04.785 Script: /directory567
> 2016-07-15 16:45:04.785 Script: option transfer binary
< 2016-07-15 16:45:04.785 Script: transfer binary
> 2016-07-15 16:45:04.785 Script: lcd "D:\share\new"
< 2016-07-15 16:45:04.785 Script: D:\share\new
> 2016-07-15 16:45:04.785 Script: get *.xml
. 2016-07-15 16:45:04.785 Listing directory "/directory567".
> 2016-07-15 16:45:04.785 Type: SSH_FXP_OPENDIR, Size: 24, Number: 267
< 2016-07-15 16:45:04.941 Type: SSH_FXP_HANDLE, Size: 25, Number: 267
> 2016-07-15 16:45:04.941 Type: SSH_FXP_READDIR, Size: 25, Number: 524
< 2016-07-15 16:45:05.097 Type: SSH_FXP_NAME, Size: 472, Number: 524
> 2016-07-15 16:45:05.097 Type: SSH_FXP_READDIR, Size: 25, Number: 780
< 2016-07-15 16:45:05.253 Type: SSH_FXP_STATUS, Size: 33, Number: 780
< 2016-07-15 16:45:05.253 Status code: 1
> 2016-07-15 16:45:05.253 Type: SSH_FXP_CLOSE, Size: 25, Number: 1028
. 2016-07-15 16:45:05.253 .;d;0;2016-07-15T06:45:04.000Z;"myserver.com" [10165026];"myusername" [19344];rwxrwx---;2
. 2016-07-15 16:45:05.253 ..;d;0;2016-02-16T03:24:38.000Z;"myusername" [10082416];"myusername" [19344];rwxrwx---;0
. 2016-07-15 16:45:05.253 123456.xml;-;1727;2016-07-15T06:45:04.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:05.253 123456789.xml;-;1727;2016-07-15T06:45:05.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:05.253 Copying 2 files/directories to local directory "D:\share\new"
. 2016-07-15 16:45:05.253 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2016-07-15 16:45:05.253 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2016-07-15 16:45:05.253 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2016-07-15 16:45:05.253 File: '/directory567/123456.xml' [2016-07-15T06:45:04.000Z] [1727]
. 2016-07-15 16:45:05.253 Copying "/directory567/123456.xml" to local directory started.
. 2016-07-15 16:45:05.253 Binary transfer mode selected.
. 2016-07-15 16:45:05.253 Opening remote file.
> 2016-07-15 16:45:05.253 Type: SSH_FXP_OPEN, Size: 43, Number: 1283
< 2016-07-15 16:45:05.409 Type: SSH_FXP_STATUS, Size: 24, Number: 1028
. 2016-07-15 16:45:05.409 Discarding reserved response
< 2016-07-15 16:45:05.550 Type: SSH_FXP_HANDLE, Size: 25, Number: 1283
> 2016-07-15 16:45:05.550 Type: SSH_FXP_FSTAT, Size: 25, Number: 1544
< 2016-07-15 16:45:05.706 Type: SSH_FXP_ATTRS, Size: 37, Number: 1544
> 2016-07-15 16:45:05.706 Type: SSH_FXP_READ, Size: 37, Number: 1797
< 2016-07-15 16:45:06.018 Status code: 1
. 2016-07-15 16:45:06.018 3 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2016-07-15 16:45:06.018 Type: SSH_FXP_CLOSE, Size: 25, Number: 2308
. 2016-07-15 16:45:06.018 Preserving timestamp [2016-07-15T06:45:04.000Z]
. 2016-07-15 16:45:06.018 Transfer done: '/directory567/123456.xml' [1727]
. 2016-07-15 16:45:06.018 File: '/directory567/123456789.xml' [2016-07-15T06:45:05.000Z] [1727]
. 2016-07-15 16:45:06.018 Copying "/directory567/123456789.xml" to local directory started.
. 2016-07-15 16:45:06.018 Binary transfer mode selected.
. 2016-07-15 16:45:06.018 Opening remote file.
> 2016-07-15 16:45:06.018 Type: SSH_FXP_OPEN, Size: 43, Number: 2563
< 2016-07-15 16:45:06.174 Type: SSH_FXP_STATUS, Size: 24, Number: 2308
. 2016-07-15 16:45:06.174 Discarding reserved response
< 2016-07-15 16:45:06.314 Type: SSH_FXP_HANDLE, Size: 25, Number: 2563
> 2016-07-15 16:45:06.314 Type: SSH_FXP_FSTAT, Size: 25, Number: 2824
< 2016-07-15 16:45:06.470 Type: SSH_FXP_ATTRS, Size: 37, Number: 2824
> 2016-07-15 16:45:06.470 Type: SSH_FXP_READ, Size: 37, Number: 3077
< 2016-07-15 16:45:06.782 Status code: 1
. 2016-07-15 16:45:06.782 3 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2016-07-15 16:45:06.782 Type: SSH_FXP_CLOSE, Size: 25, Number: 3588
. 2016-07-15 16:45:06.782 Preserving timestamp [2016-07-15T06:45:05.000Z]
. 2016-07-15 16:45:06.782 Transfer done: '/directory567/123456789.xml' [1727]
> 2016-07-15 16:45:06.782 Script: rm *.xml
. 2016-07-15 16:45:06.782 Listing directory "/directory567".
> 2016-07-15 16:45:06.782 Type: SSH_FXP_OPENDIR, Size: 24, Number: 3851
< 2016-07-15 16:45:06.938 Type: SSH_FXP_STATUS, Size: 24, Number: 3588
. 2016-07-15 16:45:06.938 Discarding reserved response
< 2016-07-15 16:45:07.094 Type: SSH_FXP_HANDLE, Size: 25, Number: 3851
> 2016-07-15 16:45:07.094 Type: SSH_FXP_READDIR, Size: 25, Number: 4108
< 2016-07-15 16:45:07.235 Type: SSH_FXP_NAME, Size: 847, Number: 4108
> 2016-07-15 16:45:07.235 Type: SSH_FXP_READDIR, Size: 25, Number: 4364
< 2016-07-15 16:45:07.391 Type: SSH_FXP_STATUS, Size: 33, Number: 4364
< 2016-07-15 16:45:07.391 Status code: 1
> 2016-07-15 16:45:07.391 Type: SSH_FXP_CLOSE, Size: 25, Number: 4612
. 2016-07-15 16:45:07.391 .;d;0;2016-07-15T06:45:07.000Z;"myserver.com" [10165026];"myusername" [19344];rwxrwx---;2
. 2016-07-15 16:45:07.391 ..;d;0;2016-02-16T03:24:38.000Z;"myusername" [10082416];"myusername" [19344];rwxrwx---;0
. 2016-07-15 16:45:07.391 12345.xml;-;1723;2016-07-15T06:45:06.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 123456.xml;-;1727;2016-07-15T06:45:04.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 1234567.xmll;-;1743;2016-07-15T06:45:05.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 12345678.xml;-;1731;2016-07-15T06:45:07.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 123456789.xml;-;1727;2016-07-15T06:45:05.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 Deleting file "103400.xml".
> 2016-07-15 16:45:07.391 Type: SSH_FXP_REMOVE, Size: 35, Number: 4877
< 2016-07-15 16:45:07.547 Type: SSH_FXP_STATUS, Size: 24, Number: 4612
. 2016-07-15 16:45:07.547 Discarding reserved response
< 2016-07-15 16:45:07.703 Type: SSH_FXP_STATUS, Size: 24, Number: 4877
< 2016-07-15 16:45:07.703 Status code: 0
< 2016-07-15 16:45:07.703 Script: 103400.xml
. 2016-07-15 16:45:07.703 Deleting file "123456.xml".
> 2016-07-15 16:45:07.703 Type: SSH_FXP_REMOVE, Size: 35, Number: 5133
< 2016-07-15 16:45:07.859 Type: SSH_FXP_STATUS, Size: 24, Number: 5133
< 2016-07-15 16:45:07.859 Status code: 0
< 2016-07-15 16:45:07.859 Script: 123456.xml
. 2016-07-15 16:45:07.859 Deleting file "1234567.xmll".
> 2016-07-15 16:45:07.859 Type: SSH_FXP_REMOVE, Size: 35, Number: 5389
< 2016-07-15 16:45:08.015 Type: SSH_FXP_STATUS, Size: 24, Number: 5389
< 2016-07-15 16:45:08.015 Status code: 0
< 2016-07-15 16:45:08.015 Script: 1234567.xmll
. 2016-07-15 16:45:08.015 Deleting file "12345678.xml".
> 2016-07-15 16:45:08.015 Type: SSH_FXP_REMOVE, Size: 35, Number: 5645
< 2016-07-15 16:45:08.171 Type: SSH_FXP_STATUS, Size: 24, Number: 5645
< 2016-07-15 16:45:08.171 Status code: 0
< 2016-07-15 16:45:08.171 Script: 12345678.xml
. 2016-07-15 16:45:08.171 Deleting file "123456789.xml".
> 2016-07-15 16:45:08.171 Type: SSH_FXP_REMOVE, Size: 35, Number: 5901
< 2016-07-15 16:45:08.327 Type: SSH_FXP_STATUS, Size: 24, Number: 5901
< 2016-07-15 16:45:08.327 Status code: 0
< 2016-07-15 16:45:08.327 Script: 123456789.xml
> 2016-07-15 16:45:08.342 Script: close
. 2016-07-15 16:45:08.342 Closing connection.
. 2016-07-15 16:45:08.342 Sending special code: 12
. 2016-07-15 16:45:08.342 Sent EOF message
**************************************************************************************************************************************************





Martin I took you advise and youa re indeed correct. inbetween the get and rm commands those files were uploaded to the server. Thanks for your resolution.
Guest

Re: Script not getting all files using the get command

martin wrote:

I cannot tell without a full log file, so I can only assume that those 3 files did not exist when the get was called, but existed already when the rm was called.

Use get -delete instead of get and rm.
https://winscp.net/eng/docs/scriptcommand_get#delete


Thanks Martin, thanks for the reply. Here is the full log from the session

****************************************************************************************************************************************************
. 2016-07-15 16:45:00.636 --------------------------------------------------------------------------
. 2016-07-15 16:45:00.636 WinSCP Version 5.7.5 (Build 5665) (OS 6.2.9200 - Windows Server 2012 Datacenter)
. 2016-07-15 16:45:00.636 Configuration: C:\Users\myusername\AppData\Roaming\WinSCP.ini
. 2016-07-15 16:45:00.636 Log level: Normal
. 2016-07-15 16:45:00.636 Local account: mycompany\myusername
. 2016-07-15 16:45:00.636 Working directory: C:\Windows\system32
. 2016-07-15 16:45:00.636 Process ID: 12632
. 2016-07-15 16:45:00.636 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=575 /consoleinstance=_6264_681 "/script=c:\temp\script.txt"
. 2016-07-15 16:45:00.636 Time zone: Current: GMT+10, Standard: GMT+10 (AUS Eastern Standard Time), DST: GMT+11 (AUS Eastern Daylight Time), DST Start: 2/10/2016, DST End: 3/04/2016
. 2016-07-15 16:45:00.636 Login time: Friday, 15 July 2016 4:45:00 PM
. 2016-07-15 16:45:00.636 --------------------------------------------------------------------------
. 2016-07-15 16:45:00.636 Script: Retrospectively logging previous script records:
> 2016-07-15 16:45:00.636 Script: open mycompany.com -hostkey="ssh-rsa 2048 **** **** **** **** **** **** **** ****"
. 2016-07-15 16:45:00.636 --------------------------------------------------------------------------
. 2016-07-15 16:45:00.636 Session name: myserver.com (Ad-Hoc site)
. 2016-07-15 16:45:00.636 Host name: myserver.mycompany.com(Port: 22)
. 2016-07-15 16:45:00.636 User name: myusername (Password: Yes, Key file: No)
. 2016-07-15 16:45:00.636 Tunnel: No
. 2016-07-15 16:45:00.636 Transfer Protocol: SFTP (SCP)
. 2016-07-15 16:45:00.636 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2016-07-15 16:45:00.636 Disable Nagle: No
. 2016-07-15 16:45:00.636 Proxy: none
. 2016-07-15 16:45:00.636 Send buffer: 262144
. 2016-07-15 16:45:00.636 SSH protocol version: 2; Compression: No
. 2016-07-15 16:45:00.636 Bypass authentication: No
. 2016-07-15 16:45:00.636 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2016-07-15 16:45:00.636 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2016-07-15 16:45:00.636 KEX: dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN
. 2016-07-15 16:45:00.636 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A,A
. 2016-07-15 16:45:00.636 Simple channel: Yes
. 2016-07-15 16:45:00.636 Return code variable: Autodetect; Lookup user groups: A
. 2016-07-15 16:45:00.636 Shell: default
. 2016-07-15 16:45:00.636 EOL: 0, UTF: 2
. 2016-07-15 16:45:00.636 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2016-07-15 16:45:00.636 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2016-07-15 16:45:00.636 SFTP Bugs: A,A
. 2016-07-15 16:45:00.636 SFTP Server: default
. 2016-07-15 16:45:00.636 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2016-07-15 16:45:00.636 Cache directory changes: Yes, Permanent: Yes
. 2016-07-15 16:45:00.636 DST mode: 1
. 2016-07-15 16:45:00.636 --------------------------------------------------------------------------
. 2016-07-15 16:45:00.651 Looking up host "myserver.mycompany.com"
. 2016-07-15 16:45:00.838 Connecting to 1.1.1.1.1 port 22
. 2016-07-15 16:45:01.150 Server version: SSH-2.0-mod_sftp/0.9.9
. 2016-07-15 16:45:01.150 Using SSH protocol version 2
. 2016-07-15 16:45:01.150 We claim version: SSH-2.0-WinSCP_release_5.7.5
. 2016-07-15 16:45:01.150 Doing Diffie-Hellman group exchange
. 2016-07-15 16:45:01.556 Doing Diffie-Hellman key exchange with hash SHA-256
. 2016-07-15 16:45:03.210 Verifying host key rsa2 0x23,0xd4418d9ae0a5639d 40957e75ee2bf0d0 7f9d10187e807226 7ff2999897f10926 fe1e1f64a112e40e 7bbbe68d53cfaf08 793910cc89fe09d1 83170e55cbcfe982 236edea364b5b8ed ddc3d60e8e629034 cc59d7ea980efa1d e18b8a26dcc61bc0 f7be1046cd7067ec fb355f42afb4ae69 cdcce681c83be3e9 8747dc45b27abb04 53fb9afc0edadf03 04ffadd321328be4 25a616a5439d6545 f4dd9a6116652c20 3d640feea1c0e4a2 e6d74f0c321d7d8a 1c5b90e9a9d3ee47 744ffa076c03e8d4 c279cb6723619da4 070ca4ee39f786bf d2353cd62b93ead7 ad1457f62c11ff2f a1e3410339841543 863da043657eeb52 3e1ef8591a978148 108d02262e1822f9 with fingerprint ssh-rsa 2048 30:93:f8:cc:dc:44:27:38:b3:e8:c5:4a:fc:3d:cf:c1
. 2016-07-15 16:45:03.210 Host key matches cached key
. 2016-07-15 16:45:03.210 Host key fingerprint is:
. 2016-07-15 16:45:03.210 ssh-rsa 2048 30:93:f8:cc:dc:44:27:38:b3:e8:c5:4a:fc:3d:cf:c1
. 2016-07-15 16:45:03.210 Initialised AES-256 SDCTR client->server encryption
. 2016-07-15 16:45:03.210 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2016-07-15 16:45:03.210 Initialised AES-256 SDCTR server->client encryption
. 2016-07-15 16:45:03.210 Initialised HMAC-SHA-256 server->client MAC algorithm
! 2016-07-15 16:45:03.615 Using username "myusername".
. 2016-07-15 16:45:03.756 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2016-07-15 16:45:03.756 Using stored password.
. 2016-07-15 16:45:03.771 Sent password
. 2016-07-15 16:45:03.927 Access granted
. 2016-07-15 16:45:03.927 Opening session as main channel
. 2016-07-15 16:45:04.083 Opened main channel
. 2016-07-15 16:45:04.473 Started a shell/command
. 2016-07-15 16:45:04.473 --------------------------------------------------------------------------
. 2016-07-15 16:45:04.473 Using SFTP protocol.
. 2016-07-15 16:45:04.489 Doing startup conversation with host.
> 2016-07-15 16:45:04.489 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2016-07-15 16:45:04.629 Type: SSH_FXP_VERSION, Size: 138, Number: -1
. 2016-07-15 16:45:04.629 SFTP version 3 negotiated.
. 2016-07-15 16:45:04.629 SFTP versions supported by the server: 3
. 2016-07-15 16:45:04.629 Unknown server extension fsync@openssh.com="1"
. 2016-07-15 16:45:04.629 Unknown server extension posix-rename@openssh.com="1"
. 2016-07-15 16:45:04.629 Supports statvfs@openssh.com extension version "2"
. 2016-07-15 16:45:04.629 Unknown server extension fstatvfs@openssh.com="2"
. 2016-07-15 16:45:04.629 We believe the server has signed timestamps bug
. 2016-07-15 16:45:04.629 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 string are not mandatory
. 2016-07-15 16:45:04.629 Getting current directory name.
. 2016-07-15 16:45:04.629 Getting real path for '.'
> 2016-07-15 16:45:04.629 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2016-07-15 16:45:04.785 Type: SSH_FXP_NAME, Size: 113, Number: 16
. 2016-07-15 16:45:04.785 Real path is '/'
. 2016-07-15 16:45:04.785 Startup conversation with host finished.
< 2016-07-15 16:45:04.785 Script: Active session: [1] myusername@myserver.mycompany.com
> 2016-07-15 16:45:04.785 Script: cd "directory567"
. 2016-07-15 16:45:04.785 Cached directory change via "directory567" to "/directory567".
. 2016-07-15 16:45:04.785 Getting current directory name.
< 2016-07-15 16:45:04.785 Script: /directory567
> 2016-07-15 16:45:04.785 Script: option transfer binary
< 2016-07-15 16:45:04.785 Script: transfer binary
> 2016-07-15 16:45:04.785 Script: lcd "D:\share\new"
< 2016-07-15 16:45:04.785 Script: D:\share\new
> 2016-07-15 16:45:04.785 Script: get *.xml
. 2016-07-15 16:45:04.785 Listing directory "/directory567".
> 2016-07-15 16:45:04.785 Type: SSH_FXP_OPENDIR, Size: 24, Number: 267
< 2016-07-15 16:45:04.941 Type: SSH_FXP_HANDLE, Size: 25, Number: 267
> 2016-07-15 16:45:04.941 Type: SSH_FXP_READDIR, Size: 25, Number: 524
< 2016-07-15 16:45:05.097 Type: SSH_FXP_NAME, Size: 472, Number: 524
> 2016-07-15 16:45:05.097 Type: SSH_FXP_READDIR, Size: 25, Number: 780
< 2016-07-15 16:45:05.253 Type: SSH_FXP_STATUS, Size: 33, Number: 780
< 2016-07-15 16:45:05.253 Status code: 1
> 2016-07-15 16:45:05.253 Type: SSH_FXP_CLOSE, Size: 25, Number: 1028
. 2016-07-15 16:45:05.253 .;d;0;2016-07-15T06:45:04.000Z;"myserver.com" [10165026];"myusername" [19344];rwxrwx---;2
. 2016-07-15 16:45:05.253 ..;d;0;2016-02-16T03:24:38.000Z;"myusername" [10082416];"myusername" [19344];rwxrwx---;0
. 2016-07-15 16:45:05.253 123456.xml;-;1727;2016-07-15T06:45:04.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:05.253 123456789.xml;-;1727;2016-07-15T06:45:05.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:05.253 Copying 2 files/directories to local directory "D:\share\new"
. 2016-07-15 16:45:05.253 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2016-07-15 16:45:05.253 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2016-07-15 16:45:05.253 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2016-07-15 16:45:05.253 File: '/directory567/123456.xml' [2016-07-15T06:45:04.000Z] [1727]
. 2016-07-15 16:45:05.253 Copying "/directory567/123456.xml" to local directory started.
. 2016-07-15 16:45:05.253 Binary transfer mode selected.
. 2016-07-15 16:45:05.253 Opening remote file.
> 2016-07-15 16:45:05.253 Type: SSH_FXP_OPEN, Size: 43, Number: 1283
< 2016-07-15 16:45:05.409 Type: SSH_FXP_STATUS, Size: 24, Number: 1028
. 2016-07-15 16:45:05.409 Discarding reserved response
< 2016-07-15 16:45:05.550 Type: SSH_FXP_HANDLE, Size: 25, Number: 1283
> 2016-07-15 16:45:05.550 Type: SSH_FXP_FSTAT, Size: 25, Number: 1544
< 2016-07-15 16:45:05.706 Type: SSH_FXP_ATTRS, Size: 37, Number: 1544
> 2016-07-15 16:45:05.706 Type: SSH_FXP_READ, Size: 37, Number: 1797
< 2016-07-15 16:45:06.018 Status code: 1
. 2016-07-15 16:45:06.018 3 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2016-07-15 16:45:06.018 Type: SSH_FXP_CLOSE, Size: 25, Number: 2308
. 2016-07-15 16:45:06.018 Preserving timestamp [2016-07-15T06:45:04.000Z]
. 2016-07-15 16:45:06.018 Transfer done: '/directory567/123456.xml' [1727]
. 2016-07-15 16:45:06.018 File: '/directory567/123456789.xml' [2016-07-15T06:45:05.000Z] [1727]
. 2016-07-15 16:45:06.018 Copying "/directory567/123456789.xml" to local directory started.
. 2016-07-15 16:45:06.018 Binary transfer mode selected.
. 2016-07-15 16:45:06.018 Opening remote file.
> 2016-07-15 16:45:06.018 Type: SSH_FXP_OPEN, Size: 43, Number: 2563
< 2016-07-15 16:45:06.174 Type: SSH_FXP_STATUS, Size: 24, Number: 2308
. 2016-07-15 16:45:06.174 Discarding reserved response
< 2016-07-15 16:45:06.314 Type: SSH_FXP_HANDLE, Size: 25, Number: 2563
> 2016-07-15 16:45:06.314 Type: SSH_FXP_FSTAT, Size: 25, Number: 2824
< 2016-07-15 16:45:06.470 Type: SSH_FXP_ATTRS, Size: 37, Number: 2824
> 2016-07-15 16:45:06.470 Type: SSH_FXP_READ, Size: 37, Number: 3077
< 2016-07-15 16:45:06.782 Status code: 1
. 2016-07-15 16:45:06.782 3 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2016-07-15 16:45:06.782 Type: SSH_FXP_CLOSE, Size: 25, Number: 3588
. 2016-07-15 16:45:06.782 Preserving timestamp [2016-07-15T06:45:05.000Z]
. 2016-07-15 16:45:06.782 Transfer done: '/directory567/123456789.xml' [1727]
> 2016-07-15 16:45:06.782 Script: rm *.xml
. 2016-07-15 16:45:06.782 Listing directory "/directory567".
> 2016-07-15 16:45:06.782 Type: SSH_FXP_OPENDIR, Size: 24, Number: 3851
< 2016-07-15 16:45:06.938 Type: SSH_FXP_STATUS, Size: 24, Number: 3588
. 2016-07-15 16:45:06.938 Discarding reserved response
< 2016-07-15 16:45:07.094 Type: SSH_FXP_HANDLE, Size: 25, Number: 3851
> 2016-07-15 16:45:07.094 Type: SSH_FXP_READDIR, Size: 25, Number: 4108
< 2016-07-15 16:45:07.235 Type: SSH_FXP_NAME, Size: 847, Number: 4108
> 2016-07-15 16:45:07.235 Type: SSH_FXP_READDIR, Size: 25, Number: 4364
< 2016-07-15 16:45:07.391 Type: SSH_FXP_STATUS, Size: 33, Number: 4364
< 2016-07-15 16:45:07.391 Status code: 1
> 2016-07-15 16:45:07.391 Type: SSH_FXP_CLOSE, Size: 25, Number: 4612
. 2016-07-15 16:45:07.391 .;d;0;2016-07-15T06:45:07.000Z;"myserver.com" [10165026];"myusername" [19344];rwxrwx---;2
. 2016-07-15 16:45:07.391 ..;d;0;2016-02-16T03:24:38.000Z;"myusername" [10082416];"myusername" [19344];rwxrwx---;0
. 2016-07-15 16:45:07.391 12345.xml;-;1723;2016-07-15T06:45:06.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 123456.xml;-;1727;2016-07-15T06:45:04.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 1234567.xmll;-;1743;2016-07-15T06:45:05.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 12345678.xml;-;1731;2016-07-15T06:45:07.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 123456789.xml;-;1727;2016-07-15T06:45:05.000Z;"myserver.com" [10165026];"myusername" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 Deleting file "103400.xml".
> 2016-07-15 16:45:07.391 Type: SSH_FXP_REMOVE, Size: 35, Number: 4877
< 2016-07-15 16:45:07.547 Type: SSH_FXP_STATUS, Size: 24, Number: 4612
. 2016-07-15 16:45:07.547 Discarding reserved response
< 2016-07-15 16:45:07.703 Type: SSH_FXP_STATUS, Size: 24, Number: 4877
< 2016-07-15 16:45:07.703 Status code: 0
< 2016-07-15 16:45:07.703 Script: 103400.xml
. 2016-07-15 16:45:07.703 Deleting file "123456.xml".
> 2016-07-15 16:45:07.703 Type: SSH_FXP_REMOVE, Size: 35, Number: 5133
< 2016-07-15 16:45:07.859 Type: SSH_FXP_STATUS, Size: 24, Number: 5133
< 2016-07-15 16:45:07.859 Status code: 0
< 2016-07-15 16:45:07.859 Script: 123456.xml
. 2016-07-15 16:45:07.859 Deleting file "1234567.xmll".
> 2016-07-15 16:45:07.859 Type: SSH_FXP_REMOVE, Size: 35, Number: 5389
< 2016-07-15 16:45:08.015 Type: SSH_FXP_STATUS, Size: 24, Number: 5389
< 2016-07-15 16:45:08.015 Status code: 0
< 2016-07-15 16:45:08.015 Script: 1234567.xmll
. 2016-07-15 16:45:08.015 Deleting file "12345678.xml".
> 2016-07-15 16:45:08.015 Type: SSH_FXP_REMOVE, Size: 35, Number: 5645
< 2016-07-15 16:45:08.171 Type: SSH_FXP_STATUS, Size: 24, Number: 5645
< 2016-07-15 16:45:08.171 Status code: 0
< 2016-07-15 16:45:08.171 Script: 12345678.xml
. 2016-07-15 16:45:08.171 Deleting file "123456789.xml".
> 2016-07-15 16:45:08.171 Type: SSH_FXP_REMOVE, Size: 35, Number: 5901
< 2016-07-15 16:45:08.327 Type: SSH_FXP_STATUS, Size: 24, Number: 5901
< 2016-07-15 16:45:08.327 Status code: 0
< 2016-07-15 16:45:08.327 Script: 123456789.xml
> 2016-07-15 16:45:08.342 Script: close
. 2016-07-15 16:45:08.342 Closing connection.
. 2016-07-15 16:45:08.342 Sending special code: 12
. 2016-07-15 16:45:08.342 Sent EOF message
**************************************************************************************************************************************************
martin

Re: Script not getting all files using the get command

I cannot tell without a full log file, so I can only assume that those 3 files did not exist when the get was called, but existed already when the rm was called.

Use get -delete instead of get and rm.
https://winscp.net/eng/docs/scriptcommand_get#delete
Irishm

Script not getting all files using the get command

Script using WinSCP.com logs onto ftp site, grabs whatever xml files are there to a local directory and then deletes them

This is the batch script

@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script=c:\temp\script.txt

here is the script.text

# Connect to SFTP server using a password
open wwwwwww:xxxxxxxxxxx.com -hostkey="ssh-rsa 2048 00:00:00:00:00:27:38......"
# Change remote directory
cd "directory567"
# Force binary mode transfer
option transfer binary
# Download file to the local directory
lcd "D:\share\new"
get *.xml
rm *.xml
# Disconnect
close
bye


This all works fine...in most cases.

I have had reports of some xml files not getting downloaded only deleted, i have an example of some below, this session had 5 xml files. only 2 files got copied from the remote server to the local and then deleted from the remote server, but 3 never got copied, they got only deleted, it shows in the error that

3 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packet


. 2016-07-15 16:45:05.253 Copying 2 files/directories to local directory "D:\share\new"
. 2016-07-15 16:45:05.253 File: '/directory567/12345.xml' [2016-07-15T06:45:04.000Z] [1727]
. 2016-07-15 16:45:05.253 Copying "/directory567/12345.xml" to local directory started.
. 2016-07-15 16:45:05.253 Binary transfer mode selected.
. 2016-07-15 16:45:05.253 Opening remote file.
> 2016-07-15 16:45:05.253 Type: SSH_FXP_OPEN, Size: 43, Number: 1283
< 2016-07-15 16:45:05.409 Type: SSH_FXP_STATUS, Size: 24, Number: 1028
. 2016-07-15 16:45:05.409 Discarding reserved response
< 2016-07-15 16:45:05.550 Type: SSH_FXP_HANDLE, Size: 25, Number: 1283
> 2016-07-15 16:45:05.550 Type: SSH_FXP_FSTAT, Size: 25, Number: 1544
< 2016-07-15 16:45:05.706 Type: SSH_FXP_ATTRS, Size: 37, Number: 1544
> 2016-07-15 16:45:05.706 Type: SSH_FXP_READ, Size: 37, Number: 1797
< 2016-07-15 16:45:06.018 Status code: 1
. 2016-07-15 16:45:06.018 3 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packet
> 2016-07-15 16:45:06.018 Type: SSH_FXP_CLOSE, Size: 25, Number: 2308
. 2016-07-15 16:45:06.018 Preserving timestamp [2016-07-15T06:45:04.000Z]
. 2016-07-15 16:45:06.018 Transfer done: '/directory567/12345.xml' [1727]
. 2016-07-15 16:45:06.018 File: '/directory567/123456.xml' [2016-07-15T06:45:05.000Z] [1727]
. 2016-07-15 16:45:06.018 Copying "/directory567/123456.xml" to local directory started.
. 2016-07-15 16:45:06.018 Binary transfer mode selected.
. 2016-07-15 16:45:06.018 Opening remote file.
> 2016-07-15 16:45:06.018 Type: SSH_FXP_OPEN, Size: 43, Number: 2563
< 2016-07-15 16:45:06.174 Type: SSH_FXP_STATUS, Size: 24, Number: 2308
. 2016-07-15 16:45:06.174 Discarding reserved response
< 2016-07-15 16:45:06.314 Type: SSH_FXP_HANDLE, Size: 25, Number: 2563
> 2016-07-15 16:45:06.314 Type: SSH_FXP_FSTAT, Size: 25, Number: 2824
< 2016-07-15 16:45:06.470 Type: SSH_FXP_ATTRS, Size: 37, Number: 2824
> 2016-07-15 16:45:06.470 Type: SSH_FXP_READ, Size: 37, Number: 3077
< 2016-07-15 16:45:06.782 Status code: 1
. 2016-07-15 16:45:06.782 3 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2016-07-15 16:45:06.782 Type: SSH_FXP_CLOSE, Size: 25, Number: 3588
. 2016-07-15 16:45:06.782 Preserving timestamp [2016-07-15T06:45:05.000Z]
. 2016-07-15 16:45:06.782 Transfer done: '/directory567/103396.xml' [1727]
> 2016-07-15 16:45:06.782 Script: rm *.xml

here is one of the 2 that did get downloaded and then removed.

. 2016-07-15 16:45:05.253 12345678.xml;-;1727;2016-07-15T06:45:04.000Z;"blahblah" [19344];rw-rw----;0
. 2016-07-15 16:45:05.253 File: '/directory567/12345678.xml' [2016-07-15T06:45:04.000Z] [1727]
. 2016-07-15 16:45:05.253 Copying "/directory567/12345678.xml" to local directory started.
. 2016-07-15 16:45:06.018 Transfer done: '/directory567/12345678.xml' [1727]
. 2016-07-15 16:45:07.391 12345678.xml;-;1727;2016-07-15T06:45:04.000Z;"" [19344];rw-rw----;0
. 2016-07-15 16:45:07.703 Deleting file "12345678.xml".
. 2016-07-15 16:45:07.859 Script: 12345678.xml

Here is one of the 3 files that never made it, only deleted

. 2016-07-15 16:45:07.391 1234567.xml;-;1723;2016-07-15T06:45:06.000Z;"blahblah" [19344];rw-rw----;0
. 2016-07-15 16:45:07.391 Deleting file "1234567.xml".
. 2016-07-15 16:45:07.703 Script: 1234567.xml

Any help would be very much approciated. Do I need to put additional paramaters in the script or os this a setting on the remote server?