17th October 2013
Note: this is a draft post back from 2010. As it is still useful to me, I’ve decided to publish it as is.
I had already mused on the powers of rsync before.
This time, a reminder to self on how to resume copying broken scp/mc/fish transfers, using rsync.
First, an assortment of example commands.
rsync --partial file_to_transfer user@remotehost:/path/remote_file
rsync -av --partial --progress --inplace SRC DST
rsync --partial --progress --rsh=ssh host:/work/source.tar.bz2 .
rsync --partial --progress --rsh=ssh -r email@example.com:/datafiles/ ./
One could also try the
--append option of rsync to base the transfer resumption on the sizes of the two files rather than verifying that their contents match.
Now a single command line explained in a little more details:
rsync -vrPtz -e ssh host:/remote_path/* /local_path/
-e ssh rsync will use ssh client instead of rsh, which makes data exchange encrypted
-z compress file transfer
-t preserve time (other attributes, such as owner and permissions are also possible)
-P resume incomplete file transfer
-r recurse into subdirectories
To specify a port when using ssh you must add it to the ssh command.
rsync --partial --progress --rsh="ssh -p 16703" user@host:path