Diff’ing Directory Structures: Take 2

cf. previous post

In the comments of that post, Gregg points out a bit of handy shell scripting, but it’s not quite complete.

The real command (at least on OS X) is:

find /path/to/dir -name "*" -exec md5 '{}' > /path/to/outputfile \;

The only variables above are /path/to/dir where you specify the path from root for the directory you want to investigate, and /path/to/outputfile where you specify the path from root and filename where you want the results of your MD5 checksums to be saved. Of course, you could change the * part of the command to filter the results to certain file types or names e.g., “*.txt”.

So… you’d run that on 2 different directory trees (say, a live filesystem and its backup), then run diff on the 2 output files to compare their contents. I will use the diff that’s built into BBEdit; I find it easier to understand.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s