i want to get the md5, the sha1 and the sh256 of all the file of my computer.
The expected out put is "the file name","the md5","the size".
main()
{
liste=`sudo ls -R`
for l in $liste
do
#echo $l
g=`md5sum $l`
printf "\"$l\","
echo $g | awk '{printf("\"%s\",",$1)}'
ls -lh $l | awk '{printf("\"%s\",",$5)}'
printf "\n"
done
}
cd /
main
this is not working because it can't use md5sum in an other directory.
so I get this error message :
md5sum: rc6.d: No such file or directory
"rc6.d","",ls: cannot access 'rc6.d': No such file or directory
how do i get acces to the file ?
I tried :
#!/usr/bin/env bash
main()
{
liste=`sudo find`
for l in $liste
do
#echo $l
g=`md5sum $l`
printf "\"$l\","
echo $g | awk '{printf("\"%s\",",$1)}'
ls -lh $l | awk '{printf("\"%s\",",$5)}'
printf "\n"
done
}
cd /
main
But i get this :
find: ‘./mnt/c/ProgramData/Microsoft/Windows NT/MSFax’: Permission denied
find: ‘./mnt/c/ProgramData/Packages’: Permission denied
find: ‘./mnt/c/ProgramData/VMware/VMware USB Arbitration Service’: Permission denied
find: ‘./mnt/c/ProgramData/WindowsHolographicDevices’: Permission denied
find: ‘./mnt/c/System Volume Information’: Permission denied
find: ‘./mnt/c/Users/cypri/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc/LocalState/rootfs’: Permission denied
find: ‘./mnt/c/Users/cypri/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc/LocalState/temp/{05418818-9381-4d3c-9934-ac417ee93067}’: Permission denied
find: ‘./mnt/c/Users/cypri/AppData/Local/Temp/WYU9188.tmp.dir’: Permission denied
find: ‘./mnt/c/Windows/appcompat/Programs’: Permission denied
find: ‘./mnt/c/Windows/CSC’: Permission denied
the best commande i fond so far is :
find -type f -readable -printf '%kkB ' -exec md5sum -- {} \;
how do i get the sha1 and the md5 on the same line : "sha1","md5",
i tried :
find -type f -readable -printf '%kkB ' -exec md5sum -exec sha1 -- {} \;
but it didn't work.