Copy a File to Server Over SSH and Pick Up Where it Left Off

Sometimes you want to copy a single large file and have them restart where it left off if the transfer fails. Instead of using scp, you can use rsync for this. The below example would copy the file “/data/files.zip” on server 10.3.12.5 to your current directory. A single “dot” represents the current directory in shell scripts.

Copy file from server to current directory

rsync -avz --progress --partial 10.3.12.5:/data/files.zip .

Copy file from server to current directory and limit bandwidth used

rsync -avz --bwlimit=250 --partial --stats --progress 10.3.12.5:/data/files.zip .

Copy file from desktop to server limit bandwidth used

rsync -avz --bwlimit=250 --partial --stats --progress ~/Downloads/images.zip [email protected]:/data/

Leave a Reply

Your email address will not be published.