$ find . -type f -print0 | xargs -0 md5sum >checksums
to create a list of checksums. Then, form within directory 2, verify the list of checksums
$ md5sum -c checksums 2>&1 | grep -q FAILED\$ && echo FAIL
(The advantage of using the checksumming technique is that the directories don't need to be accessible from the same machine (as a direct block-by-block comparison would require). You only need to copy the checksums file.)
This assumes that directory 2 isn't a subdirectory of directory 1. Also, you haven't specified what is supposed to happen, if there are additional files in directory 2, which are not present in directory 1 (they would be ignored by this approach). |