I want to write a batch script that has the ability to generate and verify md5 hashes of an entire directory tree. Is there any program like this for windows?
I can find many md5 programs, but they don't verify or recur.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
so if you are familiar with the command line here are a few tools you can try:
The original URL no longer works, so the above uses the wayback machine. If you click the link that takes you to the download site it will also use the wayback machine so here is a direct link that seems to still work: https://www.jam-software.com/filelist/
filelist /? FileList V2.0 Prints a list of all files in a file system branch FILELIST [/OPTION] [/FILTER pattern1;pattern2;...] Path [>list.csv] /OWNERS Adds a coluimn with the file owners (slower) /NOHEADER Leaves out the column headers and only prints the raw data /ATTRIBUTES Includes the attributes that are set for each files /MD5 Adds a column wit the MD5 checksum of each file /AUTHORS Additionally extracts name of the author from MS Office documents /LASTSAVEDATE Additionally extracts the last save date from MS Office documents /FILTER Allows to specify one or more filters, separated with semicolons For example: filelist /md5 C:\temp > list.csv Add new files then run again filelist /md5 C:\temp > list2.csv
or md5deep from http://md5deep.sourceforge.net/start-md5deep.html
md5deep.exe -r C:\temp >> md5hashes1.txt modify files and run again md5deep.exe -r C:\temp >> md5hashes2.txt
now just compare list.csv with list2.csv either in excel or with any diff utility (Windifff for example)
otherwise go for:
MD5summer from http://www.md5summer.org/
Why reinvent the wheel? Since you specifically said you were looking for a Windows app, I recommend HashCheck Shell Extension
It can do all that you ask and is very light on resources.
I don't think you can do this sorry. An md5 hash is a hash of a a stream of bytes, but a directory tree is not a stream of bytes. A folder is an index of files (which are streams of bytes) and other folders. Now technically folders are just files themselves, but there is no "predifined" ordering for all the files, so I do no think it is possible.
So instead I think you first need to encode the directory into a single stream of bytes (i.e. file). A command line version of zip or winRar will accomplish this. If speed is an issue, there are options to not actually do any compression. There's probably a windows port of tar as well, or maybe even a windows native equivalent (.cab files?). I'd probably go with 7zip and use the comamndline
7z.exe (included in installer)
So your script could create the single file, and then get the MD5 hash of that. And then your script could delete the single file. Not exactly what you want, but I think its your best option.