Hello,

I wanted to see whether 2 directories are identical in terms of content. So what I did was tar the directories and then md5sum-ed them and then compare but the hashes were not identical. I tried to go inside each directory and md5sum-ed each file of each directory and compared individually and then each file in the different directory seemed to have the same hash. Then I checked with the tars and then tars of different directories didn't match (by using diff). So now that is causing md5sum to not match. But then why would that happen? So now which one is wrong - tar or md5sum?

Thanks.

Neither, they're both correct. A tar file contains metadata as well as the original data, so if the metadata doesn't match then the checksums won't. If you look on wikipedia for tar(file format) you'll see that the metadata includes stuff like creation data fro both the files and the tarball

sounds interesting. May be I should try to experiment with the generated tar file. Thanks for the reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.