Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
Pages: 1
I'm wondering if there is an easy way making a md5 file for each on the directory or do i have to run md5sum for each file?
md5sum film1.iso > film1.md5
md5sum film2.iso > film2.md5
md5sum film3.iso > film3.md5
Offline
for f in `find . -type f`; do (md5sum ${f} > ${f}.md5); done
Offline
Thanks
Offline
In a single command:
find -type f -exec md5sum {} \; >CHECKSUMS.md5
You can combine it with any other find options (man find for more info):
find -iname *.iso -type f -exec md5sum {} \; >CHECKSUMS.md5
(md5 of all filenames that match *.iso case insensitive from the actual folder)
find Music -iname *.mp3 -mtime -1 -type f -exec md5sum {} \; >CHECKSUMS.md5
(md5 of all filenames that match *.mp3 case insensitive in "Music" folder that have been modified in the last 24 hours)
I love Unix
Offline
Thanks
Any problem with spaces in the filename as it was in the first one?
Last edited by Marijom (2009-02-17 09:11:22)
Offline
And if I want to do more then a single command e.g. check if there already exist a md5 for the file
devotee wrote:
In a single command:
find -type f -exec md5sum {} \; >CHECKSUMS.md5
You can combine it with any other find options (man find for more info):
find -iname *.iso -type f -exec md5sum {} \; >CHECKSUMS.md5
(md5 of all filenames that match *.iso case insensitive from the actual folder)
find Music -iname *.mp3 -mtime -1 -type f -exec md5sum {} \; >CHECKSUMS.md5
(md5 of all filenames that match *.mp3 case insensitive in "Music" folder that have been modified in the last 24 hours)
I love Unix
Offline
I don't know if there is any interest in the end result but here it is
#!/ffp/bin/sh
#-vx
if [ "$1" == "" ]
then
find -type f -exec $0 "{}" \;
exit
fi
if [ -d "$1" ]
then
find "$1" -type f -exec $0 "{}" \;
exit
fi
if [ -f "$1" ]
then
ffile=$1
Ext=${ffile##*.}
if [ "$Ext" != "md5" ]
then
Path=${ffile%/*}
file="./${ffile##*/}"
md5file="./checksum.md5"
cd "$Path"
if [ -f $md5file ]
then
grep -F -i "$file" $md5file > /dev/null
if [ $? -ne 0 ]
then
echo "md5sum $ffile"
#sleep 10
md5sum "$file" >> $md5file
else
echo "Done $ffile"
fi
else
echo "md5sum $ffile"
md5sum "$file">$md5file
fi
fi
fi
Offline
Pages: 1