Comparing directories

brian_d_foy on 2004-02-04T21:02:52

Maintaining my modules while I am here is a pain in the ass, which is why I am so glad that Andy does most of it.

I cannot setup SSH on these public computers, so I am effectively locked out of using CVS from them. So, I tar my directory on my Powerbook, carry it via SneakerNet to the public computers, upload it to a unix account, untar it, then cvs update it. Usually I find conflicts because I cannot update it as often as I would like.

The other day Andy updated a lot of stuff, so I got a fresh working copy and did the previous process in reverse, thinking I would just compare the files in the fresh copy with the files in my local copy.

I could have written a shell script to traverse the two directories to make the comparisons, or I could have written a Perl script. But, I had the bright idea of checking diff(1) to see if it would do it, and, at lest on Mac OS X, it does.

% diff -r dir1 dir2


That compares every file, but some of the files, sya, pm_to_blib, do not matter, so I can skip some files.

% diff -X dir1/MANIFEST.SKIP -r dir1 dir2


Isn't that nifty?