I would like to copy multiple files simultaneously to speed up my process I currently used the follow
scp -r [email protected]:/var/www/example/example.example.com .
but it only copies one file at a time. I have a 100 Mbps fibre so I have the bandwidth available to really copy a lot at the same time, please help.
You can use background task with wait command. Wait command ensures that all the background tasks are completed before processing next line. i.e echo will be executed after scp for all three nodes are completed.
#!/bin/bash
scp -i anuruddha.pem myfile1.tar [email protected]:/tmp &
scp -i anuruddha.pem myfile2.tar [email protected]:/tmp &
scp -i anuruddha.pem myfile.tar [email protected]:/tmp &
wait
echo "SCP completed"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With