Hi.
There is a script cmptree at
Unix Review > The Shell Corner: cmptree
which may be useful. It uses
cmp to compare files. Utility cmp reads a file as binary, so non-text files can be successfully compared.
If you are solving this problem essentially once, then my feeling is that to read an entire file to get the checksum may be wasting cycles if the differences occur early in the files.
In fact, the method I prefer is first to check the length of the files. This is a low-overhead operation, either with utility
stat in Linux or utility
ls otherwise. If the lengths are different, then the files are different. If the lengths are the same, then one can use something like cmp to compare the files.
The one disadvantage that I saw in cmptree is that does not handle filenames with embedded whitespace, so if you have such files, then the published version of cmptree will not be useful ... cheers, drl