missing files

Advertisement

Daniel79
Guest

missing files

I use the command line Option of winSCP, like:

"C:\Program Files (x86)\WinSCP\winscp.exe" /console /script=C:\automotive\get_files.txt /log="C:\automotive\get_files.log"

In get_files.txt:
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open sftp://user:password@example.com/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Connect
open sftp://[url] -hostkey="ssh-rsa 2048 blablabla"
# Change remote directory
cd /incoming
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get *.xml "c:\Automotive\XMLDataIn\"
rm *.xml
# Disconnect
close
# Exit WinSCP
Exit


Normaly i get the files from the Server and in 2nd step they are deleted.
Until today, WinSCP only deleted all files without copy to my side. I don´t understand this, because WinSCP hase no error or something.

Logfile:
. 2015-09-10 14:24:01.148 --------------------------------------------------------------------------
. 2015-09-10 14:24:01.148 WinSCP Version 5.5.6 (Build 4746) (OS 6.3.9600 - Windows Server 2012 R2 Standard)
. 2015-09-10 14:24:01.148 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2015-09-10 14:24:01.148 Local account: USER
. 2015-09-10 14:24:01.148 Working directory: C:\Windows\system32
. 2015-09-10 14:24:01.148 Process ID: 6984
. 2015-09-10 14:24:01.148 Command-line: "C:\Program Files (x86)\WinSCP\winscp.exe" /console /script=C:\automotive\get_files.txt /log="C:\automotive\get_files.log"
. 2015-09-10 14:24:01.148 Time zone: Current: GMT+2, Standard: GMT+1 (Mitteleuropäische Zeit), DST: GMT+2 (Mitteleuropäische Sommerzeit), DST Start: 29.03.2015, DST End: 25.10.2015
. 2015-09-10 14:24:01.148 Login time: Donnerstag, 10. September 2015 14:24:01
. 2015-09-10 14:24:01.148 --------------------------------------------------------------------------
. 2015-09-10 14:24:01.148 Script: Retrospectively logging previous script records:
> 2015-09-10 14:24:01.148 Script: option batch abort
< 2015-09-10 14:24:01.148 Script: batch abort
> 2015-09-10 14:24:01.148 Script: option confirm off
< 2015-09-10 14:24:01.148 Script: confirm off
> 2015-09-10 14:24:01.148 Script: open sftp://URL -hostkey="ssh-rsa 2048 ..."
. 2015-09-10 14:24:01.148 --------------------------------------------------------------------------
. 2015-09-10 14:24:01.148 Session name: USER (Modified site)
. 2015-09-10 14:24:01.148 Host name: URL (Port: 22)
. 2015-09-10 14:24:01.148 User name: USER (Password: Yes, Key file: No)
. 2015-09-10 14:24:01.148 Tunnel: No
. 2015-09-10 14:24:01.148 Transfer Protocol: SFTP
. 2015-09-10 14:24:01.148 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2015-09-10 14:24:01.148 Proxy: none
. 2015-09-10 14:24:01.148 Send buffer: 262144
. 2015-09-10 14:24:01.148 SSH protocol version: 2; Compression: No
. 2015-09-10 14:24:01.148 Bypass authentication: No
. 2015-09-10 14:24:01.148 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2015-09-10 14:24:01.148 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2015-09-10 14:24:01.148 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2015-09-10 14:24:01.148 Simple channel: Yes
. 2015-09-10 14:24:01.148 Return code variable: Autodetect; Lookup user groups: A
. 2015-09-10 14:24:01.148 Shell: default
. 2015-09-10 14:24:01.148 EOL: 0, UTF: 2
. 2015-09-10 14:24:01.148 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2015-09-10 14:24:01.148 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2015-09-10 14:24:01.148 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2015-09-10 14:24:01.148 Cache directory changes: Yes, Permanent: Yes
. 2015-09-10 14:24:01.148 DST mode: 1; Timezone offset: 0h 0m
. 2015-09-10 14:24:01.148 --------------------------------------------------------------------------
. 2015-09-10 14:24:01.148 Looking up host "URL"
. 2015-09-10 14:24:01.273 Connecting to IP port 22
. 2015-09-10 14:24:01.320 Server version: SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu3
. 2015-09-10 14:24:01.320 Using SSH protocol version 2
. 2015-09-10 14:24:01.320 We claim version: SSH-2.0-WinSCP_release_5.5.6
. 2015-09-10 14:24:01.351 Doing Diffie-Hellman group exchange
. 2015-09-10 14:24:01.429 Doing Diffie-Hellman key exchange with hash SHA-256
. 2015-09-10 14:24:02.554 Verifying host key rsa2 ... with fingerprint ssh-rsa 2048 ...
. 2015-09-10 14:24:02.554 Host key matches configured key
. 2015-09-10 14:24:02.554 Host key fingerprint is:
. 2015-09-10 14:24:02.554 ssh-rsa 2048 ...
. 2015-09-10 14:24:02.554 Initialised AES-256 SDCTR client->server encryption
. 2015-09-10 14:24:02.554 Initialised HMAC-SHA1 client->server MAC algorithm
. 2015-09-10 14:24:02.554 Initialised AES-256 SDCTR server->client encryption
. 2015-09-10 14:24:02.554 Initialised HMAC-SHA1 server->client MAC algorithm
! 2015-09-10 14:24:02.648 Using username "USER".
. 2015-09-10 14:24:02.679 Prompt (7, SSH password, , &Passwort:)
. 2015-09-10 14:24:02.679 Using stored password.
. 2015-09-10 14:24:02.679 Sent password
. 2015-09-10 14:24:02.695 Access granted
. 2015-09-10 14:24:02.695 Opening session as main channel
. 2015-09-10 14:24:02.726 Opened main channel
. 2015-09-10 14:24:02.804 Started a shell/command
. 2015-09-10 14:24:02.804 --------------------------------------------------------------------------
. 2015-09-10 14:24:02.804 Using SFTP protocol.
. 2015-09-10 14:24:02.804 Doing startup conversation with host.
> 2015-09-10 14:24:02.804 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2015-09-10 14:24:02.820 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2015-09-10 14:24:02.820 SFTP version 3 negotiated.
. 2015-09-10 14:24:02.820 We believe the server has signed timestamps bug
. 2015-09-10 14:24:02.820 We will use UTF-8 strings when appropriate
. 2015-09-10 14:24:02.820 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2015-09-10 14:24:02.835 Getting current directory name.
. 2015-09-10 14:24:02.835 Getting real path for '.'
> 2015-09-10 14:24:02.835 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2015-09-10 14:24:02.851 Type: SSH_FXP_NAME, Size: 23, Number: 16
. 2015-09-10 14:24:02.851 Real path is '/'
. 2015-09-10 14:24:02.851 Startup conversation with host finished.
< 2015-09-10 14:24:02.851 Script: Aktive Sitzung: [1] USER
> 2015-09-10 14:24:02.851 Script: cd /incoming
. 2015-09-10 14:24:02.851 Cached directory change via "/incoming" to "/incoming".
. 2015-09-10 14:24:02.851 Getting current directory name.
< 2015-09-10 14:24:02.851 Script: /incoming
> 2015-09-10 14:24:02.851 Script: option transfer binary
< 2015-09-10 14:24:02.851 Script: transfer binary
> 2015-09-10 14:24:02.851 Script: get *.xml "c:\Automotive\XMLDataIn\"
. 2015-09-10 14:24:02.851 Listing directory "/incoming".
> 2015-09-10 14:24:02.851 Type: SSH_FXP_OPENDIR, Size: 18, Number: 267
< 2015-09-10 14:24:02.882 Type: SSH_FXP_HANDLE, Size: 13, Number: 267
> 2015-09-10 14:24:02.882 Type: SSH_FXP_READDIR, Size: 13, Number: 524
< 2015-09-10 14:24:02.898 Type: SSH_FXP_NAME, Size: 210, Number: 524
> 2015-09-10 14:24:02.898 Type: SSH_FXP_READDIR, Size: 13, Number: 780
< 2015-09-10 14:24:02.929 Type: SSH_FXP_STATUS, Size: 28, Number: 780
< 2015-09-10 14:24:02.929 Status code: 1
> 2015-09-10 14:24:02.929 Type: SSH_FXP_CLOSE, Size: 13, Number: 1028

[not part of Logfile: Normaly at this point WinSCP copy the remote files to local side, but not at this try]

. 2015-09-10 14:24:02.929 .;d;4096;2015-09-10T11:37:00.000Z;"USER" [2057];"2057" [2057];rwxr-xr-x;2
. 2015-09-10 14:24:02.929 ..;d;4096;2014-01-29T08:10:23.000Z;"0" [0];"0" [0];rwxr-xr-x;0
> 2015-09-10 14:24:02.929 Script: rm *.xml
. 2015-09-10 14:24:02.929 Listing directory "/incoming".
> 2015-09-10 14:24:02.929 Type: SSH_FXP_OPENDIR, Size: 18, Number: 1291
< 2015-09-10 14:24:02.945 Type: SSH_FXP_STATUS, Size: 24, Number: 1028
. 2015-09-10 14:24:02.945 Discarding reserved response
< 2015-09-10 14:24:02.976 Type: SSH_FXP_HANDLE, Size: 13, Number: 1291
> 2015-09-10 14:24:02.976 Type: SSH_FXP_READDIR, Size: 13, Number: 1548
< 2015-09-10 14:24:02.991 Type: SSH_FXP_NAME, Size: 750, Number: 1548
> 2015-09-10 14:24:02.991 Type: SSH_FXP_READDIR, Size: 13, Number: 1804
< 2015-09-10 14:24:03.023 Type: SSH_FXP_STATUS, Size: 28, Number: 1804
< 2015-09-10 14:24:03.023 Status code: 1
> 2015-09-10 14:24:03.023 Type: SSH_FXP_CLOSE, Size: 13, Number: 2052
. 2015-09-10 14:24:03.023 ORDERSDE_60151.xml;-;1899;2015-09-10T12:22:00.000Z;"USER" [2057];"2057" [2057];rw-r-----;0
. 2015-09-10 14:24:03.023 ORDERSDE_60152.xml;-;2555;2015-09-10T12:22:00.000Z;"USER" [2057];"2057" [2057];rw-r-----;0
. 2015-09-10 14:24:03.023 ORDERSDE_60154.xml;-;4244;2015-09-10T12:22:00.000Z;"USER" [2057];"2057" [2057];rw-r-----;0
. 2015-09-10 14:24:03.023 ORDERSDE_60153.xml;-;2358;2015-09-10T12:22:00.000Z;"USER" [2057];"2057" [2057];rw-r-----;0
. 2015-09-10 14:24:03.023 .;d;4096;2015-09-10T12:22:00.000Z;"USER" [2057];"2057" [2057];rwxr-xr-x;2
. 2015-09-10 14:24:03.023 ..;d;4096;2014-01-29T08:10:23.000Z;"0" [0];"0" [0];rwxr-xr-x;0
. 2015-09-10 14:24:03.023 Deleting file "ORDERSDE_60151.xml".
> 2015-09-10 14:24:03.023 Type: SSH_FXP_REMOVE, Size: 37, Number: 2317
< 2015-09-10 14:24:03.038 Type: SSH_FXP_STATUS, Size: 24, Number: 2052
. 2015-09-10 14:24:03.038 Discarding reserved response
< 2015-09-10 14:24:03.070 Type: SSH_FXP_STATUS, Size: 24, Number: 2317
< 2015-09-10 14:24:03.070 Status code: 0
< 2015-09-10 14:24:03.070 Script: ORDERSDE_60151.xml
. 2015-09-10 14:24:03.070 Deleting file "ORDERSDE_60152.xml".
> 2015-09-10 14:24:03.070 Type: SSH_FXP_REMOVE, Size: 37, Number: 2573
< 2015-09-10 14:24:03.085 Type: SSH_FXP_STATUS, Size: 24, Number: 2573
< 2015-09-10 14:24:03.085 Status code: 0
< 2015-09-10 14:24:03.085 Script: ORDERSDE_60152.xml
. 2015-09-10 14:24:03.085 Deleting file "ORDERSDE_60154.xml".
> 2015-09-10 14:24:03.085 Type: SSH_FXP_REMOVE, Size: 37, Number: 2829
< 2015-09-10 14:24:03.116 Type: SSH_FXP_STATUS, Size: 24, Number: 2829
< 2015-09-10 14:24:03.116 Status code: 0
< 2015-09-10 14:24:03.116 Script: ORDERSDE_60154.xml
. 2015-09-10 14:24:03.116 Deleting file "ORDERSDE_60153.xml".
> 2015-09-10 14:24:03.116 Type: SSH_FXP_REMOVE, Size: 37, Number: 3085
< 2015-09-10 14:24:03.132 Type: SSH_FXP_STATUS, Size: 24, Number: 3085
< 2015-09-10 14:24:03.132 Status code: 0
< 2015-09-10 14:24:03.132 Script: ORDERSDE_60153.xml
> 2015-09-10 14:24:03.132 Script: close
. 2015-09-10 14:24:03.132 Closing connection.
. 2015-09-10 14:24:03.132 Sending special code: 12
. 2015-09-10 14:24:03.132 Sent EOF message

Reply with quote

Advertisement

Guest

Re: missing files

martin wrote:

I guess the files were moved to the /incoming folder the moment between the get and rm commands.

It's not safe to implement the "download and delete" using get and rm commands, exactly for this reason.

Use get -delete only instead.

See https://winscp.net/eng/docs/scriptcommand_get

Ooops, i missed the -delete Switch. Thanks!

Reply with quote

Advertisement

You can post new topics in this forum