md5deep not working with duplicated files in different directories

3

1

I want to use md5deep to check that some copied directories are copied correctly. But seems md5deep doesn't use the filenames stored in the genearted .md5-files when matching!

This actually means, that if I copy a big directory structure (with duplicated files) and something went wrong, so one directory contains files (with correct filenames and wrong content), then md5deep will NOT find this as a mismatch!

EXAMPLE:

Imagine we have the following file structure:

photos\public_photo1.jpg
photos\public_photo2.jpg
photos\private_photo1.jpg
photos\photos_my_mother_can_see\public_photo1.jpg
photos\photos_my_mother_can_see\public_photo2.jpg

As you can see, two of the photos are duplicated files!

Now imagine that my copying utility failed, so that the CONTENT of public_photo1.jpg actually was the CONTENT of private_photo1.jpg. The directory-structure is still the same!

On my source-drive I did the following to generate the MD5-file:

md5deep64 -rel c:\photos\*.* > result.md5

(I use relative paths!)

Afterwards I match the files with the destination-folder:

md5deep64 -X result.md5 -r c:\photosdest

No changes found!!

If I even do a match (md5deep64 -wm result.md5 -r c:\photosdest) I can even see, how it didn't use the filenames to compare:

c:\photosdest\photos_my_mother_can_see\public_photo1.jpg matched c:\photos\private_photo1.jpg
c:\photosdest\public_photo1.jpg matched c:\photos\photos_my_mother_can_see\public_photo1.jpg
c:\photosdest\public_photo2.jpg matched c:\photos\public_photo2.jpg
c:\photosdest\photos_my_mother_can_see\public_photo2.jpg matched c:\photos\public_photo2.jpg
c:\photosdest\private_photo1.jpg matched c:\photos\private_photo1.jpg

:-(

Is it a feature or a bug?

Is there any way I can force md5deep is compare the MD5 of files with the same filename and location? ...or should I start looking for another md5-generator/comparer?

SanSaurus

Posted 2012-02-08T12:51:24.570

Reputation: 145

Answers

4

This is a feature of md5deep, not a bug. It sounds like you want to use the companion program hashdeep. That program comes with md5deep.

md5deep was intended to find files regardless of the filename. For example, when searching for the rootkit EVILEVIL.EXE, the user would want to find any file with the same hash as EVILEVIL, even if it had been renamed fuzzykitten.exe.

The hashdeep program, on the other hand, can do an audit, which checks the file size, location, and hash when matching.

Jesse Kornblum

Posted 2012-02-08T12:51:24.570

Reputation: 41