OCAU News - Wiki - QuickLinks - Pix - Sponsors
|22nd May 2005, 11:24 PM||#1|
Join Date: Feb 2002
Using NTFS streams and md5 checksum for integrity checking
Sometimes I scare myself.
I figured some of you might find it useful somehow.
Some guy on atomic did a post about NTFS file streams : here
Anyway, the only thing I could think of NTFS streams being useful for is invisibly storing checksums to verify data integrity.
So I set about making a batch file to make, store and compare md5 checksums.
Personally I'm going to use it to ensure the integrity of large archived files
(only for ntfs obviously)
So, here it is :
"Md5s.bat" to be used in conjunction with md5sum.exe link
@Echo off set a=0 set errors=0 if "%1"=="-c" goto %1 if "%1"=="-m" goto %1 echo. Echo Usage is " md5s.bat -m filename.ext " to create an md5 checksum Echo Or " md5s.bat -c filename.ext " to check the md5 checksum of a file echo -c or -m MUST be present echo. goto end :-m for %%i in (%2) do (md5sum "%%i">"%%i":md5 || (set /a errors=errors+1 & echo. & Echo %%i ***********ERROR***********) echo %%i done set /a a=a+1 ) echo. echo. Echo ================================ echo %a% files checked Echo %errors% Failed goto end :-c for %%i in (%2) do ( md5sum -c "%%i":md5|| (set /a errors=errors+1 & echo. & Echo ***********ERROR*********** & echo.) set /a a=a+1 ) echo. echo. Echo ================================ echo %a% files checked Echo %errors% Bad or missing Checksums echo. :end
md5c -m *.* will calculate the md5 for all files and save it to the file in an alternate filesystem stream called :md5
md5c -c *.* will calculate the md5's and compare them with the previously caculated md5 for that file
It works with individual filenames and with wildcards.
Please comment if you think it's useful.
Last edited by Myne_h; 22nd May 2005 at 11:35 PM.
|Join OCAU to remove this ad!|
Sign up for a free OCAU account and this ad will go away!