Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to scp about a half dozen files in a couple directories to the same directories on a target machine.

Without utilizing ssh keys, is this possible in one call?

For example:

scp /path/to/fileA,/anoth/erpath/to/fileB,/yet/more/files/*    #continue next line
    destination:/path/to,/anoth/erpath/to,/yet/more/files
share|improve this question

3 Answers

up vote 5 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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).

share|improve this answer
does this get around needing to ask for the passwords each time a file from A goes to B? – warren Sep 30 '10 at 13:39
2  
For that I am using ssh-add. You type your credentials once at the beginning of a day. Then you are logged in automatically. – Casual Coder Sep 30 '10 at 17:03
thanks for the suggestion :) – warren Oct 1 '10 at 18:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.