[CLUG-tech] tar to md5sum

Jonathan Hitchcock jonathanh at adept.co.za
Mon Mar 12 10:27:10 SAST 2007


Hans van der Merwe wrote:
> I need to check the integrity of two dirs.  One process generates DIR1
> and then generates a checksum.  Other machine rsyncs DIR1 to DIR2
> locally and then executes the same checksum.
> How do I generate the checksum?

md5sum will probably do the trick, but you have to make sure that you're
md5summing the right thing.  If you wanted to simply check that the two
directories had the same files with the same names, you could go:

find DIRNAME | sort | md5sum

to generate the checksum.

If you want to make sure that the files are the right size, too, you can go:

find -printf "%s %p\n" | sort | md5sum

And so on - add more info if you want to check more factors.


(However, as usual, Stefano has provided a brilliant answer to the
question that should have been asked, instead of my mediocre answer to
the question that was actually asked... ;-)


More information about the clug-tech mailing list