View Full Version : Compare two directory trees for differences in their files

Arjen Visser
11-20-2011, 12:09 PM
This compares the files in 2 directories. Both these directories are under svn control.

rsync --dry-run --exclude=".svn" -Hav dbvisit-trunk/dbvserver/ project542/dbvserver/

Note: the slash at the end of the paths is of importance, as it means "the content of" to rsync.

Rsync lists all directories it enters, but ONLY files which would be rsync'ed are listed, i.e. those files that are different between the trees.

EXTRA: Stick this one into /etc/bash.bashrc.local (or ~/.bashrc or what ever you use) to add an alias to your shell environment:

alias treediff='rsync --dry-run --exclude=".svn" -Hav '

then use it like so:

treediff dbvisit-trunk/dbvserver/ project542/dbvserver/

Thanks to Holger Jahn for this neat trick.