hashvalue filename ; much like a bindry hash is hashvalue* filename
my current attempt is to
1- make the file.md5
2- read that finished txt file , file,md5 into a var
3- trim the first 32 char from that var
BUT my effort to read the file.md5 back into a var does not GET the string
?? what am i doing wrong ... and also ...is there a better way that i am not seeing
here is what i am doing
I ask the usr to drag in the dir that has the many files to make md5 for
all that is working fine .
my problem is the creation of the hash-list.txt
Code: Select all
@echo off
echo makes md5 hash
echo * ----------------------------------------------------------------------------*
echo *** You will be asked to drag here: ***
echo *** ***
echo ** just drag your dir to this shell , have focus in the shell and hit enter ***
echo I make md5sum hash checksums
set logfile=make-hash.txt
set /p srcDir=Drag your Source Directory here:%=%
@echo %scrcDir%
REM pause
cd /D %srcDir%
dir
REM pause
for /f %%a IN ('dir /b *.*') do (
echo hashing file %%a
rem makes md5 hash
REM -- and the below is working a OK , these are made
md5sum -b %%a > %%a.md5
rem cleans file removes dos ^M carriage returns
dos2unix.exe %%a.md5
rem pull hash val full string
REM THIS is what is not working
REM should not this work?? a %%.md5 does exist and is correct in all ways
rem set /p hashString=< %%a.md5
REM i put this echo to try and see what is happening : i only get " my hash string is "
echo my hash string is %hashString%
set hash=%hashString:~0,32%
echo %hash%
rem build hash_list.txt
echo %hash% %%a >> hash_list.txt
)
rem optional
rem cleans file removes dos ^M carriage returns
rem dos2unix.exe hash_list.txt
echo *******************************************************************************
echo *******************************************************************************
echo you may close this shell
pause