Is it possible to have an md5 checksum file (as generated from somethng like md5sum -r * > checklist.chk
where each line contains just the hash and the filename of the file (and not the path from the current directory to the file)?
I have two large directory trees that I am looking to compare, except the second directory tree has a different structure as i use it more often and have been slowly rearranging things over time. I am curious if it is possible to have md5sum
check all the files in the first directory tree to see if they have the same filename and hash as some file, somewhere in the second directory tree.
Most of the posts i have found so far don't seem to touch on this use case where file paths dont matter.
Essentially, i want to be able to do this:
- open second directory tree and generate a checksum list (using something like
md5sum -r * > checklist.chk
except each line only contains the file's hash and name (without the path) - open the first directory tree and go through every file and verifying its hash against the checksum list from step 1 to determine whether or not they exist in the second directory tree.
md5sum
(orsha1sum
) both directory trees, thensort
, which will group identical files together. BTW,md5sum
and friends compute their checksums ONLY on the file's contents, not the filename.