put *.* with append

Advertisement

mikeb
Joined:
Posts:
7
Location:
UK

put *.* with append

I'm trying to make a script that PUTs all files in a directory onto the server. The basic script works OK when the destination files don't exist (which they usually won't). However, when the file does already exist remotely I would like the local file to be appended to the existing remote one. And then afterwards, the local file is deleted. This is what I've got at present:

put -append -delete localpath\*.*

But this overwrites the existing files regardless. I guess it's probably because I need to state a target for the append flag to work, but how do I do that with *.*? The filenames will be different every day so I can't specify what the target name is, other than the same as the source file name.

Can this be achieved fairly easily? The alternative, not so automated, is to script it to check for existing files and decline to carry out the put command.

Reply with quote

Advertisement

mikeb
Joined:
Posts:
7
Location:
UK

I've done more testing and it doesn't appear to be related to the use of a wild card *.*. Even with the following command:

put -append -delete localpath\test.txt /test.txt

It still overwrites the destination, rather than appending to it. The delete parameter works as expected though. I've looked in the winscp log file, but can't see anything obvious there, not totally sure what I should be seeing there though. I've updated to WinSCP 5.6.2 just in case, but it hasn't made any difference.

Could it be the sftp server (freeFTPd) not compatible with the append function, or is it implemented entirely on the client side?

Reply with quote

mikeb
Joined:
Posts:
7
Location:
UK

Yes, I'm using sftp. This is the entire script:

option batch abort
option confirm off
open sftp://servername -certificate="xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
cd /remotepath
option transfer binary
put -resumesupport=off -append -delete localpath\*.*
close
exit

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Please attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

mikeb
Joined:
Posts:
7
Location:
UK

Here's a log file from a recent attempt, I think I've hashed out everything sensitive. I did tweak the put parameters slightly to try and get it to work, but the result is still the same - all files are overwritten rather than appended.


. 2014-10-31 14:49:45.890 --------------------------------------------------------------------------
. 2014-10-31 14:49:45.890 WinSCP Version 5.6.2 (Build 4756) (OS 5.1.2600 Service Pack 3 - Microsoft Windows XP)
. 2014-10-31 14:49:45.890 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2014-10-31 14:49:45.890 Local account: ICORE2\Mike
. 2014-10-31 14:49:45.890 Working directory: C:\#####
. 2014-10-31 14:49:45.890 Process ID: 5236
. 2014-10-31 14:49:45.890 Command-line: "c:\Program Files\WinSCP\WinSCP.exe" /console=562 /consoleinstance=_5572_613 "/script=uploadsalesscp.txt"
. 2014-10-31 14:49:45.890 Time zone: Current: GMT+0, Standard: GMT+0 (GMT Standard Time), DST: GMT+1 (GMT Standard Time), DST Start: 30/03/2014, DST End: 26/10/2014
. 2014-10-31 14:49:45.890 Login time: 31 October 2014 14:49:45
. 2014-10-31 14:49:45.890 --------------------------------------------------------------------------
. 2014-10-31 14:49:45.890 Script: Retrospectively logging previous script records:
> 2014-10-31 14:49:45.890 Script: option batch abort
< 2014-10-31 14:49:45.890 Script: batch abort
< 2014-10-31 14:49:45.890 Script: reconnecttime 120
> 2014-10-31 14:49:45.890 Script: option confirm off
< 2014-10-31 14:49:45.890 Script: confirm off
> 2014-10-31 14:49:45.890 Script: open sftp://################################### -certificate="xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
. 2014-10-31 14:49:45.890 --------------------------------------------------------------------------
. 2014-10-31 14:49:45.890 Session name: ################################## (Modified site)
. 2014-10-31 14:49:45.890 Host name: s################################## (Port: 2222)
. 2014-10-31 14:49:45.890 User name: ######### (Password: Yes, Key file: No)
. 2014-10-31 14:49:45.890 Tunnel: No
. 2014-10-31 14:49:45.890 Transfer Protocol: SFTP
. 2014-10-31 14:49:45.890 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2014-10-31 14:49:45.890 Proxy: none
. 2014-10-31 14:49:45.890 Send buffer: 262144
. 2014-10-31 14:49:45.890 SSH protocol version: 2; Compression: No
. 2014-10-31 14:49:45.890 Bypass authentication: No
. 2014-10-31 14:49:45.890 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2014-10-31 14:49:45.890 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2014-10-31 14:49:45.890 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A
. 2014-10-31 14:49:45.890 Simple channel: Yes
. 2014-10-31 14:49:45.890 Return code variable: Autodetect; Lookup user groups: A
. 2014-10-31 14:49:45.890 Shell: default
. 2014-10-31 14:49:45.890 EOL: 0, UTF: 2
. 2014-10-31 14:49:45.890 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2014-10-31 14:49:45.890 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2014-10-31 14:49:45.890 SFTP Bugs: A,A
. 2014-10-31 14:49:45.890 SFTP Server: default
. 2014-10-31 14:49:45.890 Local directory: C:\Documents and Settings\Mike\My Documents, Remote directory: /sales, Update: Yes, Cache: Yes
. 2014-10-31 14:49:45.890 Cache directory changes: Yes, Permanent: Yes
. 2014-10-31 14:49:45.890 DST mode: 1
. 2014-10-31 14:49:45.890 --------------------------------------------------------------------------
. 2014-10-31 14:49:45.890 Looking up host "#################################"
. 2014-10-31 14:49:45.890 Connecting to ################################## port 2222
. 2014-10-31 14:49:46.015 Server version: SSH-2.0-WeOnlyDo-wodFTPD 3.2.2.395
. 2014-10-31 14:49:46.015 We believe remote version has SSH-2 rekey bug
. 2014-10-31 14:49:46.015 Using SSH protocol version 2
. 2014-10-31 14:49:46.015 We claim version: SSH-2.0-WinSCP_release_5.6.2
. 2014-10-31 14:49:46.156 Using Diffie-Hellman with standard group "group14"
. 2014-10-31 14:49:46.156 Doing Diffie-Hellman key exchange with hash SHA-1
. 2014-10-31 14:49:46.609 Verifying host key rsa2 0x23,0xc963c64d1f6d7b0a b0272db36a5d4f87 0c1f538e0e1cd24e c999837fa32979fc bb37a0f6c1583961 edec930d890c9deb 196c2ce9d749fee9 a5b9083eb5700074 4b052e6e0a3699f5 eeb379f083ad2bce 3ff302c2b8600031 ed4a6e6749ac8eaf 156afa4d91b7aa51 6aad81eb1e085037 8bcb73ac68e28fc2 52478cd7509debe1 with fingerprint ssh-rsa 1024 de:56:f8:df:09:02:0a:ec:16:48:41:91:38:b7:9f:48
. 2014-10-31 14:49:46.609 Host key matches cached key
. 2014-10-31 14:49:46.609 Host key fingerprint is:
. 2014-10-31 14:49:46.609 ssh-rsa 1024 de:56:f8:df:09:02:0a:ec:16:48:41:91:38:b7:9f:48
. 2014-10-31 14:49:46.609 Initialised AES-256 SDCTR client->server encryption
. 2014-10-31 14:49:46.609 Initialised HMAC-SHA1 client->server MAC algorithm
. 2014-10-31 14:49:46.656 Initialised AES-256 SDCTR server->client encryption
. 2014-10-31 14:49:46.656 Initialised HMAC-SHA1 server->client MAC algorithm
! 2014-10-31 14:49:46.718 Using username "##########".
! 2014-10-31 14:49:46.781 Further authentication required
. 2014-10-31 14:49:46.781 Further authentication required
. 2014-10-31 14:49:46.781 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2014-10-31 14:49:46.781 Using stored password.
. 2014-10-31 14:49:46.781 Sent password
. 2014-10-31 14:49:47.015 Access granted
. 2014-10-31 14:49:47.015 Opening session as main channel
. 2014-10-31 14:49:47.062 Opened main channel
. 2014-10-31 14:49:47.312 Started a shell/command
. 2014-10-31 14:49:47.312 --------------------------------------------------------------------------
. 2014-10-31 14:49:47.312 Using SFTP protocol.
. 2014-10-31 14:49:47.312 Doing startup conversation with host.
> 2014-10-31 14:49:47.312 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2014-10-31 14:49:47.375 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2014-10-31 14:49:47.375 SFTP version 4 negotiated.
. 2014-10-31 14:49:47.375 We will use UTF-8 strings as it is mandatory with SFTP version 4 and newer
. 2014-10-31 14:49:47.375 Changing directory to "/sales".
. 2014-10-31 14:49:47.375 Getting real path for '/sales'
> 2014-10-31 14:49:47.375 Type: SSH_FXP_REALPATH, Size: 15, Number: 16
< 2014-10-31 14:49:47.437 Type: SSH_FXP_NAME, Size: 25, Number: 16
. 2014-10-31 14:49:47.437 Real path is '/sales'
. 2014-10-31 14:49:47.437 Trying to open directory "/sales".
> 2014-10-31 14:49:47.437 Type: SSH_FXP_LSTAT, Size: 19, Number: 263
< 2014-10-31 14:49:47.484 Type: SSH_FXP_ATTRS, Size: 46, Number: 263
. 2014-10-31 14:49:47.484 Getting current directory name.
. 2014-10-31 14:49:47.484 Startup conversation with host finished.
< 2014-10-31 14:49:47.484 Script: Active session: [1] ##################################
> 2014-10-31 14:49:47.484 Script: cd /sales
. 2014-10-31 14:49:47.484 Cached directory change via "/sales" to "/sales".
. 2014-10-31 14:49:47.484 Getting current directory name.
< 2014-10-31 14:49:47.484 Script: /sales
> 2014-10-31 14:49:47.500 Script: option transfer binary
< 2014-10-31 14:49:47.500 Script: transfer binary
> 2014-10-31 14:49:47.500 Script: put -resumesupport=off -append -filemask=*.txt c:\############\sales\* *
< 2014-10-31 14:49:47.500 Script: Using configured transfer settings different from factory defaults.
. 2014-10-31 14:49:47.500 Copying 12 files/directories to remote directory "/sales"
. 2014-10-31 14:49:47.500 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: N (102400); CalcS: No; Mask: *
. 2014-10-31 14:49:47.500 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: *.txt; ResumeL: 0
. 2014-10-31 14:49:47.500 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2014-10-31 14:49:47.500 File: 'c:\##################################.txt' [2014-10-30T22:05:09.718Z] [125]
. 2014-10-31 14:49:47.500 Copying "c:\##################################" to remote directory started.
. 2014-10-31 14:49:47.500 Binary transfer mode selected.
. 2014-10-31 14:49:47.500 Opening remote file.
> 2014-10-31 14:49:47.500 Type: SSH_FXP_OPEN, Size: 54, Number: 515
< 2014-10-31 14:49:47.562 Type: SSH_FXP_HANDLE, Size: 27, Number: 515
> 2014-10-31 14:49:47.562 Type: SSH_FXP_WRITE, Size: 164, Number: 1030
> 2014-10-31 14:49:47.562 Type: SSH_FXP_CLOSE, Size: 27, Number: 1284
> 2014-10-31 14:49:47.562 Type: SSH_FXP_SETSTAT, Size: 58, Number: 777
< 2014-10-31 14:49:47.625 Type: SSH_FXP_STATUS, Size: 24, Number: 1030
< 2014-10-31 14:49:47.671 Type: SSH_FXP_STATUS, Size: 24, Number: 1284
< 2014-10-31 14:49:47.671 Status code: 0
. 2014-10-31 14:49:47.671 Preserving timestamp [2014-10-30T22:05:09.000Z]
< 2014-10-31 14:49:47.921 Type: SSH_FXP_STATUS, Size: 24, Number: 777
< 2014-10-31 14:49:47.921 Status code: 0
. 2014-10-31 14:49:47.921 File: 'c:##################################.txt' [2014-10-30T22:05:09.796Z] [45]
. 2014-10-31 14:49:47.921 Copying "c:\##################################.txt" to remote directory started.
. 2014-10-31 14:49:47.921 Binary transfer mode selected.
. 2014-10-31 14:49:47.921 Opening remote file.
> 2014-10-31 14:49:47.921 Type: SSH_FXP_OPEN, Size: 54, Number: 1539
< 2014-10-31 14:49:47.984 Type: SSH_FXP_HANDLE, Size: 27, Number: 1539
> 2014-10-31 14:49:47.984 Type: SSH_FXP_WRITE, Size: 84, Number: 2054
> 2014-10-31 14:49:47.984 Type: SSH_FXP_CLOSE, Size: 27, Number: 2308
> 2014-10-31 14:49:47.984 Type: SSH_FXP_SETSTAT, Size: 58, Number: 1801
< 2014-10-31 14:49:48.031 Type: SSH_FXP_STATUS, Size: 24, Number: 2054
< 2014-10-31 14:49:48.093 Type: SSH_FXP_STATUS, Size: 24, Number: 2308
< 2014-10-31 14:49:48.093 Status code: 0
. 2014-10-31 14:49:48.093 Preserving timestamp [2014-10-30T22:05:09.000Z]
< 2014-10-31 14:49:48.312 Type: SSH_FXP_STATUS, Size: 24, Number: 1801
< 2014-10-31 14:49:48.312 Status code: 0
. 2014-10-31 14:49:48.312 File: 'c:\##################################.txt' [2014-10-30T22:05:09.890Z] [74]
. 2014-10-31 14:49:48.312 Copying "c:\##################################.txt" to remote directory started.
. 2014-10-31 14:49:48.312 Binary transfer mode selected.
. 2014-10-31 14:49:48.312 Opening remote file.
> 2014-10-31 14:49:48.312 Type: SSH_FXP_OPEN, Size: 54, Number: 2563
< 2014-10-31 14:49:48.375 Type: SSH_FXP_HANDLE, Size: 27, Number: 2563
> 2014-10-31 14:49:48.375 Type: SSH_FXP_WRITE, Size: 113, Number: 3078
> 2014-10-31 14:49:48.375 Type: SSH_FXP_CLOSE, Size: 27, Number: 3332
> 2014-10-31 14:49:48.375 Type: SSH_FXP_SETSTAT, Size: 58, Number: 2825
< 2014-10-31 14:49:48.437 Type: SSH_FXP_STATUS, Size: 24, Number: 3078
< 2014-10-31 14:49:48.500 Type: SSH_FXP_STATUS, Size: 24, Number: 3332
< 2014-10-31 14:49:48.500 Status code: 0
. 2014-10-31 14:49:48.500 Preserving timestamp [2014-10-30T22:05:09.000Z]
< 2014-10-31 14:49:48.718 Type: SSH_FXP_STATUS, Size: 24, Number: 2825
< 2014-10-31 14:49:48.718 Status code: 0
. 2014-10-31 14:49:48.718 File: 'c:\##################################.txt' [2014-10-30T22:05:09.984Z] [46]
. 2014-10-31 14:49:48.718 Copying "c:\##################################.txt" to remote directory started.
. 2014-10-31 14:49:48.718 Binary transfer mode selected.
. 2014-10-31 14:49:48.718 Opening remote file.
> 2014-10-31 14:49:48.718 Type: SSH_FXP_OPEN, Size: 54, Number: 3587
< 2014-10-31 14:49:48.781 Type: SSH_FXP_HANDLE, Size: 27, Number: 3587
> 2014-10-31 14:49:48.781 Type: SSH_FXP_WRITE, Size: 85, Number: 4102
> 2014-10-31 14:49:48.781 Type: SSH_FXP_CLOSE, Size: 27, Number: 4356
> 2014-10-31 14:49:48.781 Type: SSH_FXP_SETSTAT, Size: 58, Number: 3849
< 2014-10-31 14:49:48.843 Type: SSH_FXP_STATUS, Size: 24, Number: 4102
< 2014-10-31 14:49:48.906 Type: SSH_FXP_STATUS, Size: 24, Number: 4356
< 2014-10-31 14:49:48.906 Status code: 0
. 2014-10-31 14:49:48.906 Preserving timestamp [2014-10-30T22:05:09.000Z]
< 2014-10-31 14:49:49.125 Type: SSH_FXP_STATUS, Size: 24, Number: 3849
< 2014-10-31 14:49:49.125 Status code: 0
. 2014-10-31 14:49:49.125 File: 'c:\##################################.txt' [2014-10-30T22:05:10.078Z] [142]
. 2014-10-31 14:49:49.125 Copying "c:\##################################.txt" to remote directory started.
. 2014-10-31 14:49:49.125 Binary transfer mode selected.
. 2014-10-31 14:49:49.125 Opening remote file.
> 2014-10-31 14:49:49.125 Type: SSH_FXP_OPEN, Size: 54, Number: 4611
< 2014-10-31 14:49:49.187 Type: SSH_FXP_HANDLE, Size: 27, Number: 4611
> 2014-10-31 14:49:49.187 Type: SSH_FXP_WRITE, Size: 181, Number: 5126
> 2014-10-31 14:49:49.187 Type: SSH_FXP_CLOSE, Size: 27, Number: 5380
> 2014-10-31 14:49:49.187 Type: SSH_FXP_SETSTAT, Size: 58, Number: 4873
< 2014-10-31 14:49:49.234 Type: SSH_FXP_STATUS, Size: 24, Number: 5126
< 2014-10-31 14:49:49.296 Type: SSH_FXP_STATUS, Size: 24, Number: 5380
< 2014-10-31 14:49:49.296 Status code: 0
. 2014-10-31 14:49:49.296 Preserving timestamp [2014-10-30T22:05:10.000Z]
< 2014-10-31 14:49:49.625 Type: SSH_FXP_STATUS, Size: 24, Number: 4873
< 2014-10-31 14:49:49.625 Status code: 0
. 2014-10-31 14:49:49.625 File: 'c:\##################################.txt' [2014-10-30T22:05:10.156Z] [43]
. 2014-10-31 14:49:49.625 Copying "c:\##################################.txt" to remote directory started.
. 2014-10-31 14:49:49.625 Binary transfer mode selected.
. 2014-10-31 14:49:49.625 Opening remote file.
> 2014-10-31 14:49:49.625 Type: SSH_FXP_OPEN, Size: 54, Number: 5635
< 2014-10-31 14:49:49.687 Type: SSH_FXP_HANDLE, Size: 27, Number: 5635
> 2014-10-31 14:49:49.687 Type: SSH_FXP_WRITE, Size: 82, Number: 6150
> 2014-10-31 14:49:49.687 Type: SSH_FXP_CLOSE, Size: 27, Number: 6404
> 2014-10-31 14:49:49.687 Type: SSH_FXP_SETSTAT, Size: 58, Number: 5897
< 2014-10-31 14:49:49.750 Type: SSH_FXP_STATUS, Size: 24, Number: 6150
< 2014-10-31 14:49:49.812 Type: SSH_FXP_STATUS, Size: 24, Number: 6404
< 2014-10-31 14:49:49.812 Status code: 0
. 2014-10-31 14:49:49.812 Preserving timestamp [2014-10-30T22:05:10.000Z]
< 2014-10-31 14:49:50.046 Type: SSH_FXP_STATUS, Size: 24, Number: 5897
< 2014-10-31 14:49:50.046 Status code: 0
. 2014-10-31 14:49:50.046 File: 'c:\##################################.txt' [2014-10-30T22:05:10.250Z] [33]
. 2014-10-31 14:49:50.046 Copying "c:##################################.txt" to remote directory started.
. 2014-10-31 14:49:50.046 Binary transfer mode selected.
. 2014-10-31 14:49:50.046 Opening remote file.
> 2014-10-31 14:49:50.046 Type: SSH_FXP_OPEN, Size: 54, Number: 6659
< 2014-10-31 14:49:50.109 Type: SSH_FXP_HANDLE, Size: 27, Number: 6659
> 2014-10-31 14:49:50.109 Type: SSH_FXP_WRITE, Size: 72, Number: 7174
> 2014-10-31 14:49:50.109 Type: SSH_FXP_CLOSE, Size: 27, Number: 7428
> 2014-10-31 14:49:50.109 Type: SSH_FXP_SETSTAT, Size: 58, Number: 6921
< 2014-10-31 14:49:50.156 Type: SSH_FXP_STATUS, Size: 24, Number: 7174
< 2014-10-31 14:49:50.218 Type: SSH_FXP_STATUS, Size: 24, Number: 7428
< 2014-10-31 14:49:50.218 Status code: 0
. 2014-10-31 14:49:50.218 Preserving timestamp [2014-10-30T22:05:10.000Z]
< 2014-10-31 14:49:50.437 Type: SSH_FXP_STATUS, Size: 24, Number: 6921
< 2014-10-31 14:49:50.437 Status code: 0
. 2014-10-31 14:49:50.437 File: 'c:\##################################.txt' [2014-10-30T22:05:10.343Z] [46]
. 2014-10-31 14:49:50.437 Copying "c:\##################################.txt" to remote directory started.
. 2014-10-31 14:49:50.437 Binary transfer mode selected.
. 2014-10-31 14:49:50.437 Opening remote file.
> 2014-10-31 14:49:50.437 Type: SSH_FXP_OPEN, Size: 54, Number: 7683
< 2014-10-31 14:49:50.500 Type: SSH_FXP_HANDLE, Size: 27, Number: 7683
> 2014-10-31 14:49:50.500 Type: SSH_FXP_WRITE, Size: 85, Number: 8198
> 2014-10-31 14:49:50.500 Type: SSH_FXP_CLOSE, Size: 27, Number: 8452
> 2014-10-31 14:49:50.500 Type: SSH_FXP_SETSTAT, Size: 58, Number: 7945
< 2014-10-31 14:49:50.562 Type: SSH_FXP_STATUS, Size: 24, Number: 8198
< 2014-10-31 14:49:50.625 Type: SSH_FXP_STATUS, Size: 24, Number: 8452
< 2014-10-31 14:49:50.625 Status code: 0
. 2014-10-31 14:49:50.625 Preserving timestamp [2014-10-30T22:05:10.000Z]
< 2014-10-31 14:49:50.843 Type: SSH_FXP_STATUS, Size: 24, Number: 7945
< 2014-10-31 14:49:50.843 Status code: 0
. 2014-10-31 14:49:50.843 File: 'c:\##################################.txt' [2014-10-30T22:05:10.421Z] [49]
. 2014-10-31 14:49:50.843 Copying "c:\##################################.txt" to remote directory started.
. 2014-10-31 14:49:50.843 Binary transfer mode selected.
. 2014-10-31 14:49:50.843 Opening remote file.
> 2014-10-31 14:49:50.843 Type: SSH_FXP_OPEN, Size: 54, Number: 8707
< 2014-10-31 14:49:50.921 Type: SSH_FXP_HANDLE, Size: 27, Number: 8707
> 2014-10-31 14:49:50.921 Type: SSH_FXP_WRITE, Size: 88, Number: 9222
> 2014-10-31 14:49:50.921 Type: SSH_FXP_CLOSE, Size: 27, Number: 9476
> 2014-10-31 14:49:50.921 Type: SSH_FXP_SETSTAT, Size: 58, Number: 8969
< 2014-10-31 14:49:50.984 Type: SSH_FXP_STATUS, Size: 24, Number: 9222
< 2014-10-31 14:49:51.046 Type: SSH_FXP_STATUS, Size: 24, Number: 9476
< 2014-10-31 14:49:51.046 Status code: 0
. 2014-10-31 14:49:51.046 Preserving timestamp [2014-10-30T22:05:10.000Z]
< 2014-10-31 14:49:51.234 Type: SSH_FXP_STATUS, Size: 24, Number: 8969
< 2014-10-31 14:49:51.234 Status code: 0
. 2014-10-31 14:49:51.234 File: 'c:\##################################.txt' [2014-10-30T22:05:10.515Z] [710]
. 2014-10-31 14:49:51.234 Copying "c:\##################################.txt" to remote directory started.
. 2014-10-31 14:49:51.234 Binary transfer mode selected.
. 2014-10-31 14:49:51.234 Opening remote file.
> 2014-10-31 14:49:51.234 Type: SSH_FXP_OPEN, Size: 54, Number: 9731
< 2014-10-31 14:49:51.296 Type: SSH_FXP_HANDLE, Size: 27, Number: 9731
> 2014-10-31 14:49:51.296 Type: SSH_FXP_WRITE, Size: 749, Number: 10246
> 2014-10-31 14:49:51.296 Type: SSH_FXP_CLOSE, Size: 27, Number: 10500
> 2014-10-31 14:49:51.296 Type: SSH_FXP_SETSTAT, Size: 58, Number: 9993
< 2014-10-31 14:49:51.359 Type: SSH_FXP_STATUS, Size: 24, Number: 10246
< 2014-10-31 14:49:51.421 Type: SSH_FXP_STATUS, Size: 24, Number: 10500
< 2014-10-31 14:49:51.421 Status code: 0
. 2014-10-31 14:49:51.421 Preserving timestamp [2014-10-30T22:05:10.000Z]
< 2014-10-31 14:49:51.734 Type: SSH_FXP_STATUS, Size: 24, Number: 9993
< 2014-10-31 14:49:51.734 Status code: 0
. 2014-10-31 14:49:51.734 File "c:\##################################.old" excluded from transfer
* 2014-10-31 14:49:51.734 (EScpSkipFile)
. 2014-10-31 14:49:51.734 File: 'c:\##################################.txt' [2014-10-31T12:18:09.203Z] [7]
. 2014-10-31 14:49:51.734 Copying "c:\##################################.txt" to remote directory started.
. 2014-10-31 14:49:51.734 Binary transfer mode selected.
. 2014-10-31 14:49:51.734 Opening remote file.
> 2014-10-31 14:49:51.734 Type: SSH_FXP_OPEN, Size: 41, Number: 10755
< 2014-10-31 14:49:51.796 Type: SSH_FXP_HANDLE, Size: 28, Number: 10755
> 2014-10-31 14:49:51.796 Type: SSH_FXP_WRITE, Size: 47, Number: 11270
> 2014-10-31 14:49:51.796 Type: SSH_FXP_CLOSE, Size: 28, Number: 11524
> 2014-10-31 14:49:51.796 Type: SSH_FXP_SETSTAT, Size: 45, Number: 11017
< 2014-10-31 14:49:51.859 Type: SSH_FXP_STATUS, Size: 24, Number: 11270
< 2014-10-31 14:49:51.921 Type: SSH_FXP_STATUS, Size: 24, Number: 11524
< 2014-10-31 14:49:51.921 Status code: 0
. 2014-10-31 14:49:51.921 Preserving timestamp [2014-10-31T12:18:09.000Z]
< 2014-10-31 14:49:52.156 Type: SSH_FXP_STATUS, Size: 24, Number: 11017
< 2014-10-31 14:49:52.156 Status code: 0
> 2014-10-31 14:49:52.156 Script: close
. 2014-10-31 14:49:52.156 Closing connection.
. 2014-10-31 14:49:52.156 Sending special code: 12
. 2014-10-31 14:49:52.156 Sent EOF message

Reply with quote

mikeb
Joined:
Posts:
7
Location:
UK

Does the log file give any clues?

I'm wondering if append isn't supported by some sftp servers? I'm using freeftpd/freesshd, and I've also tried SolarWinds sftp server, and both overwrite rather than appending. I notice in the proftpd docs, that resume/append isn't enabled by default, but is an option. So that looks like it should support it, but I don't want to go to great lengths to setup proftpd, just to find that the problem is with my script. :?

Reply with quote

martin
Site Admin
martin avatar

You are using freeFTPd server, right? It is buggy. It does not fail an attempt to overwrite an existing file with "exclusive" flag set. That makes WinSCP fail to learn that the file already exists, hence it does not append, but override. For the same reason, WinSCP does not display overwrite confirmation prompt in GUI.

Reply with quote

Advertisement

mikeb
Joined:
Posts:
7
Location:
UK

martin wrote:

You are using freeFTPd server, right? It is buggy. It does not fail an attempt to overwrite an existing file with "exclusive" flag set. That makes WinSCP fail to learn that the file already exists, hence it does not append, but override. For the same reason, WinSCP does not display overwrite confirmation prompt in GUI.

Not sure about the exclusive flag, but I've got it working now (with freeFTPd server). I needed to change the endurance settings so resume was enabled for all files (mine were all below the size threshold).

Reply with quote

Ganesan
Guest

I am facing the same issue that the append feature is not working as it should.

I am using the below script to transfer the file using SFTP with append feature. The file is getting transferred but the file has been overwritten every time. I am using free version of 'Core FTP server'. Any help would be appreciated.

option batch on
option confirm off
open "sftp://sftpuser:sftpuser@10.20.17.210" -hostkey="ssh-rsa 2048 6d:f8:a8:e9:cc:05:95:07:16:75:53:65:35:01:2b:2d" -passive=on -timeout=300
option transfer binary
put -resumesupport=off -append "C:\Messages\sample.txt" "/"
close
exit

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: I am facing the same issue that the append feature is not working as it should.

Ganesan wrote:

I am using the below script to transfer the file using SFTP with append feature. The file is getting transferred but the file has been overwritten every time. I am using free version of 'Core FTP server'. Any help would be appreciated.

option batch on
option confirm off
open "sftp://sftpuser:sftpuser@10.20.17.210" -hostkey="ssh-rsa 2048 6d:f8:a8:e9:cc:05:95:07:16:75:53:65:35:01:2b:2d" -passive=on -timeout=300
option transfer binary
put -resumesupport=off -append "C:\Messages\sample.txt" "/"
close
exit
This is a known bug in Core FTP server. Note that when you try to overwrite an existing remote file, you do not get an overwrite confirmation. It has the same root cause.

Reply with quote

Advertisement

You can post new topics in this forum