bash - resume file transfer if aborted -


i transferring large files using rsync or scp . there times when transfer aborted need monitor , resume manually. can me write script resume file transfer aborted or completed files (source , destination) not in same size (in case transfer restart beginning- first remove destination file , transfer restarted). 1 thing mention when connect source server need provide password, password parameter of script

you need -p , --partial options.

from man page:

--partial default, rsync delete partially transferred file if transfer          interrupted. in circumstances more desirable keep partially          transferred files. using --partial option tells rsync keep partial          file should make subsequent transfer of rest of file faster.    -p     -p option equivalent --partial --progress.    pur-          pose  make easier specify these 2 options          long transfer may interrupted. 

so if want sync (continu syncing) directories:

sudo rsync -azvvp /home/path/folder1/ /home/path/folder2 

you can find additional infos here:

to resume automatically, run in loop:

retry_in=5 while rsync -azvvp /home/path/folder1/ /home/path/folder2    echo "retrying in ${retry_in} sec"    sleep "${retry_in}" done 

Comments