Rsync – copy file differences to third directory

So you have a snapshot of data on one drive, and the current state of data on the second drive. How do you copy the difference between the two drives into a third directory?

Rync comes to the rescue here. And it doesn’t take much:

A simple –compare function makes it work:

rsync -av --stats --progress --compare-dest=/live /snapshot/ /differences_drive/

So what happens? Taking all archive flags into consideration (-a) and being verbose (-v) we show the progress (--progress) of the rsync, with some fun statistics (--stats), for a comparison between /snapshot and /live and copy the files into /differences_drive

Sure beats having to md5 every file in both locations and doing an overlap comparison between them – use rsync for what it’s good for! 🙂

That should allow you to copy the files that have changed between two directories to a third, on any mounted or shared filesystem.

But you knew that already!

One comment on “Rsync – copy file differences to third directory

  1. Peter says:

    Thanks! That saved me a lot of time!

    The man page of rsync if not really clear about the –compare-dest argument “also compare received files relative to DIR”

Leave a Reply

Your email address will not be published. Required fields are marked *