rsync is similar to scp , except, well, better in most cases. It keeps a file table of all transferred files, and only transfers those that have been modified (hence the sync bit). It has the following syntax:


The most popular options are:

Option Description
-r Recursive, will sync all files in child directories also.
-a Archive mode.
-z Compress data while doing transfer. Some files cannot be compressed, which includes gz zip z rpm deb iso bz2 tbz tgz 7z mp3 mp4 mov avi ogg jpg jpeg.
-v Verbose. Will prints out more information when process is run. You can add extra v’s (e.g. -vv) to make rsync print out even more info.
-n Do a trial run which doesn’t actually make any changes. This is usually used in conjunction with -v to make sure you are doing it correctly before make any modifications.

Some of the most popular combinations of options are:

Command Description
rsync -arvz source destination Good general purpose rsync use, without propagating deletions.
rsync -adrvz source destination Good general purpose rsync use with deletion propagation (be careful!)

rsync is a great tool for allowing you write code on a fully-fledged computer, and then transfer it to a RaspberryPi easily and quickly for running. Normally it only takes a matter to seconds to transfer after you have made modest code changes.

An interesting side-note is that you can replicate the capabilities of the Mac OS time machine with rsync using the following commands (taken from

Another interesting side-note for those interested is that at the core of the compare algorithm is a MD5 checksum and a rolling checksum. This speeds up the checking, rather than comparing the files bit-by-bit. However, this can lead to errors. The probability of rsync believing two files are in sync, but actually are not, requires both a collision (a collision is when different inputs product the same output) in the MD5 and rolling checksum, which sits around the 2^-160 mark (very unlikely).

How To Incrementally Copy A Large File From Server To Local Folder

If you want to copy a large file, you may want to do it incrementally because of disconnection issues, or to resume copying at a different time. rsync supports this with the --append option.

--progress is useful as it continuously prints the percentage progress of the operation.


Posted: October 22nd, 2013 at 10:06 am
Last Updated on: April 24th, 2017 at 5:15 pm

Leave a Reply