1

I have two directories. I want to check whether all files in one directory are same as that of other directory or not by using md5sum. If the md5sum results in a difference, I want to apply diff.

So how to check md5sum and find out whether MD5 values are same or not?

1

first get md5sum of directory1 all files and write to a file.

find dir1 -type f -exec md5sum '{}' + >dir1_checksum.txt

Then find all directory2 files checksum and output those checksums didn't match using grep -vf filename.

find dir2 -type f -exec md5sum '{}' + | grep -vf dir1_checksum.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.