scp'ing multiple files in one pass - to multiple destinations on one target server?

Zip up the files on the sending side and unzip them on the receiving side.

tar -cf - /path/to/fileA /anoth/erpath/to/fileB /yet/more/files/* |
ssh -C destination 'cd / && tar -xf -'

You could also script an sftp session, or use rsync with the right filter.


You can copy from multiple src to one destination. scp -r src1 src2 ... dst But not to multiple destinations.

One option is to copy all the directory to a temp destination directory. Then move them back afterwards.


Look at pssh package. It has parallel-scp command. -h option allows you to provide text file with multiple hosts as destination (one per line).