Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SFTP and append mode

Status
Not open for further replies.

teqmem

Programmer
Nov 26, 2004
114
US
Hello,

I realize that my question is non-AIX specific but I'm sure that some AIX-centric people know the answer.

How do you append using SFTP? I use openssh. When I send a file to a remote SSH server, I sometimes need to append to an existing file.

Thank you.
 
I'm afraid you can't do this using sftp but you can use sftp inside a script to do that!

Use the sftp to copy to a temporary directory in the destination server then inside the same script use this:

Code:
fp=/Temp_Destination_Dir_path/*
fp='ls '$fp


for i in $fp
do
cat $i >> /Destination_Dir_Path/$i
done

Regards,
Khalid
 
Another way to do it is to do something like

To get a file
Code:
ssh ruser@rhost "cat /path/to/rfile" >> /path/to/localfile
to put file
Code:
cat /path/to/localfile | ssh ruser@rhost "cat >> /path/to/remotefile"


Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top