in reply to Bitwise comparision of files

Here's a non-Perl variant.

In directory 1, run

$ 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).

Replies are listed 'Best First'.
Re^2: Bitwise comparision of files
by JavaFan (Canon) on Feb 28, 2012 at 19:06 UTC
    I'd use diff -r directory1 directory2.

      As I mentioned in parentheses, the advantage of using the checksumming technique is that the directories don't need to be accessible from the same machine.

      Whether that matters here, I don't know, but I figured it might perhaps be useful to someone, sometime.

        As I mentioned in parentheses, the advantage of using the checksumming technique is that the directories don't need to be accessible from the same machine.
        Then I'd use something like rsync -rcn directory1 remote:directory2