Using scp only is there a way to copy multiple files at the same time? I have two 40G folders on a RHEL box that I want to copy over to my ESXi box. Rsync is out of option and scp is the only thing available.

If I use:

scp /files root@esx:/vmfs/volumes/storage

It will copy File_1 40G first and then once this finishes, it will start to copy File_2

I want to initiate both the 40G copy at the same time. I tried:

scp /file1 root@esx:/vmfs/volumes/storage && scp /file2 root@esxi:/vmfs/volume/storage

Still no go. One way I am using now is tar.zip the two folders and then moving them over. And then untar on the destination. Not efficient though.

Any thoughts? Thanks much

  • 2
    In theory, each file would copy half as fast due to cap on network speed.... – ivanivan Jun 24 '17 at 16:10

Execute both process parallel in the background and wait for both to finish:

($(scp /file1 root@esx:/vmfs/volumes/storage) &); ($(scp /file2 root@esxi:/vmfs/volume/storage) &);
| improve this answer | |
  • I did scp -r /run/media/tse-admin/Lab-Files/Lab-Templates/AD-vCloud root@ & scp /run/media/tse-admin/Lab-Files/Lab-Templates/Jump-Cloud root@ & wait It said. [5] 26641 [6] 26642 however there is no copy being initiated when I check for files on destination. Something wrong in my command? – suhas savkoor Jun 24 '17 at 17:11
  • My bad...check the new command running both in subshells. – marc Jun 24 '17 at 17:12
  • Well: -bash: syntax error near unexpected token ;'` – suhas savkoor Jun 24 '17 at 17:30
  • Very strange... Did you copy the exact command I posted? Please try again! – marc Jun 24 '17 at 18:00
  • But each scp needs a password when reaching the remote host? Do you use sshpass?.. If not, then both commands run forever in the background indefinitely waiting for the password. – marc Jun 24 '17 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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