I want to scp files from machineA
into my machineB
and this is how I am doing it. I am copying bunch of files one by one from primary
folder of machineA
to primary
folder of machineB
and secondary
folder of machineA
to secondary
folder of machineB
.
trinity@machineB:~$ scp trinity@machineA:/data01/primary/* /data01/primary/
trinity@machineB:~$ scp trinity@machineA:/data02/secondary/* /data02/secondary/
Is there any way by which I can copy multiple files in parallel? Like five files at a time from a folder? So instead of copying one files at a time, I want to copy five files from primary or secondary folders respectively?
Basically I want to copy whatever is there in primary and secondary folders of machineA
into machineB
parallely.
I also have GNU Parallel installed on my box if I can use that. I tried below command but it doesn't work. I was expecting that it should copy 5 files in parallel at a time until everything gets copied from that folder.
parallel -j 5 scp trinity@machineA:/data01/primary/* /data01/primary/
Anything wrong with my parallel syntax? What is the best way by which I can copy five files in parallel from a remote folder until everything gets copied from it?
Best Answer
You need the * expansion to happen on the remote side: