Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Help, please, with shell scripting for computing checksums

Daniel Freedman <freedman@xxxxxxxxxxxxxxxx> writes:

> Hi,
> First of all, I've been following slug for a bit as a Kernel Cousin under
> SLUG Pearls, but I've never posted, so I hope this is not an inappropriate
> or off-topic question.
> I'm trying to use md5sum (from Gnu Text Utilities) to compute a checksum
> for alot of files in my home directory or root directory. This wouldn't be
> a problem, except that I want it to compute the checksums on all files in
> ALL subdirectories (so that I can compare original with backup copy).
> Maybe I'm being immensely stupid, but I don't see an easy way to
> accomplish this with md5sum itself (it responds to directories "md5sum:
> bin: Is a directory"), and I'm evidently not adept enough with shell
> scripting to make this work.  I actually looked through the source code to
> think maybe I could modify md5sum itself (in case anyone else wanted to do
> similar checksums), but I quickly got in over my head; the numerical
> simulations I do seem _awfully_ different than coding for applications or
> this type of file access :).
> Any suggestions (or script fragments) would be greatly appreciated.
> Thanks so much,
> Daniel

find <dirname> -depth -type f -exec md5sum {} \;