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 myuser@example.com:/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.

Kenster
  • 8,620

1 Answers1

0

try

awk '{printf "put %s\n",$1}' /etc/files | sftp -b - -i mykey  myuser@example.com:/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
bummi
  • 1,725
  • 4
  • 16
  • 28
Archemar
  • 1,707