scp'ing multiple files in one pass - to multiple destinations on one target server?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Luau
--
Chapters
00:00 Scp'Ing Multiple Files In One Pass - To Multiple Destinations On One Target Server?
00:29 Answer 1 Score 4
00:50 Accepted Answer Score 9
01:09 Answer 3 Score 1
01:24 Answer 4 Score 0
01:52 Thank you
--
Full question
https://superuser.com/questions/193795/s...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#filemanagement #scp
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Luau
--
Chapters
00:00 Scp'Ing Multiple Files In One Pass - To Multiple Destinations On One Target Server?
00:29 Answer 1 Score 4
00:50 Accepted Answer Score 9
01:09 Answer 3 Score 1
01:24 Answer 4 Score 0
01:52 Thank you
--
Full question
https://superuser.com/questions/193795/s...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#filemanagement #scp
#avk47
ACCEPTED ANSWER
Score 9
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.
ANSWER 2
Score 4
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.
ANSWER 3
Score 1
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).
ANSWER 4
Score 0
I use the following command to copy multiple files to multiple destinations.
scp -r src{1,2,3} dest{1,2,3}
this command acts like the following set of commands
scp -r src1 dest1
scp -r src1 dest2
.
.
.
scp -r src3 dest2
scp -r src3 dest3