I need to send multiple files to multiple location, but can't find the proper way.
e.g. I need to send file1 to location1 and file2 to location2. This is what I am doing:
scp file1 file2 firstname.lastname@example.org:/location1 /location2
It's not possible to send to multiple remote locations with a single
scp command. It can accommodate multiple source files but only one destination. Using just the
scp command itself, it must be run twice.
scp file1 file2 email@example.com:/location1 scp file1 file2 firstname.lastname@example.org:/location2
It is possible to turn this into a "one-liner" by running a for loop. In bash for example:
for REMOTE in "email@example.com:/location1" "firstname.lastname@example.org:/location2"; do scp file1 file2 $REMOTE; done
scp still runs multiple times but the loop takes care of the iteration. That said, I find it easier to run the command once, hit the Up Arrow (which brings the original command back up in most environments) and just change the remote location and resend.