2

Note: using scp or other tools is off the table due to vendor requirements.

I have been set up with a private key to be able to upload numerous files to a vendor's server.

Let's say I have all of my files in /etc/files and I want to upload them as [email protected]:/files/

I was told I could do this using heredocs but I'm a little unsure. Any advice?

I have a private key so I will be using that via the -i flag.

1
  • sftp has -r (recursive copy) flag.
    – kestasx
    Dec 22, 2014 at 18:52

1 Answer 1

0

try

awk '{printf "put %s\n",$1}' /etc/files | sftp -b - -i mykey  [email protected]:/files/

where the awk stuff just turn you list of files into

put file1
put file2
...

and

  • -b - tell sftp to use stdin as batch file

Not the answer you're looking for? Browse other questions tagged .