I've been using rsync a bit lately. It's a pretty nifty tool. Nine times out of ten I just use rsync -avz source/* dest/ and let it go. But recently while trying to sort out the giant mess of data I've accumulated over the years into something manageable and useful, I discovered another use for it.
Typically if I needed to verify that two directory trees were identical, I'd just use rsync -avz as mentioned previously and let it go. The issue in this case is that the file and directory layout was the same, but the permissions were not, and the timestamps might not be. I could care less about all of that. So I dug out the rsync man page and brushed up on what exactly the -a switch does. It turns out I didn't need 90% of it. In fact all I needed was -r to recurse subdirectories. That combined with -i for more details on why a file was being targeted, and -n to do a dry run and I was all set to compare.
$ rsync -vznir Music/* /data/chiana/Music/
sending incremental file list
sent 211,557 bytes received 556 bytes 60,603.71 bytes/sec
total size is 23,226,526,155 speedup is 109,500.72 (DRY RUN)
Well look at that, everything matched! Just to be sure...
$ touch Music/foo.DELME
$ rsync -vznir Music/* /data/chiana/Music/
sending incremental file list
>f+++++++++ foo.DELME
sent 211,586 bytes received 559 bytes 424,290.00 bytes/sec
total size is 23,226,526,155 speedup is 109,484.20 (DRY RUN)
Yup! Works like a charm! I'll definitely be adding this one to my toolbox.