How can I copy a (big) directory over another changing only the files that differ?

You can use rsync to do this, the command I use is rsync -tr "folder to copy from" "folder to copy to"

e.g. rsync -tr /home/me/stuff/* /home/me/otherstuff/


It is also possible to do this with good old cp:

Thanks to srcspider for reminding me to use -T!

cp -ruT old-dir new-dir


Another good option is Unison (http://www.cis.upenn.edu/~bcpierce/unison/), particularly if there isn't really a "source" and a "destination". Each directory is a root and Unison syncs them and keeps metadata for future syncs. It offers both a command-line and a GUI option that can easily be scheduled via cron as well.

I use it to make a backup of my Dropbox to my local NAS appliance which can't run a Dropbox client.


It CAN be done with good ol' cp, though with a slightly different format than stated above. Here's how I did it:

cp -ru --target-directory="destination_path" source_path/*

You can diff the 2 directories.

diff -r dir1 dir2

it will show you the list of files that are differnet