Put with switch "-append"

Advertisement

magowoody
Joined:
Posts:
1

Put with switch "-append"

Hi.
I can't use the -append switch connected to the put operator inside a script.
My goal is to add the content of the text file I'm sending when it is already present in the destination server.
I'm using the SFTP protocol with public key access and private key with "passphrase".

This is the relevant part of my .BAT script:
rem Generate temporary script
(
  echo open sftp://<user>@<url-sftp> -privatekey=%_pathKey%\<file>.ppk -hostkey="<privatekey>" -passphrase="<passphrase>"
  echo lcd <localpath>
  echo cd <remotepath>
  echo put -append -preservetime "<file>" <file>"
  echo put -nopreservetime "<file_fake_last_connection>" "<file_fake_last_connection>"
  echo exit
 
) > script.tmp
 
rem Run temporary script
%_path%\winscp.com /ini=nul /log=%_path%\log\<file_log.log> /logsize=5*1M /loglevel=-1 /script=script.tmp
The file is sent correctly but on the server the file is always overwritten.

At the moment I solved it by importing the file from the server and then merging it with the one to be sent on the client side, but I would be interested in understanding how to use the -append switch with the put command as per the documentation https://winscp.net/eng/docs/scriptcommand_put and https://winscp.net/eng/docs/scriptcommand_put#append.

I hope someone can help me.
Max

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Put with switch "-append"

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

To generate the session log file, use /log=C:\path\to\winscp.log 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

You can post new topics in this forum