PowerShell/Scripts/hashdir.sh

21 lines
408 B
Bash
Raw Normal View History

2020-05-31 11:12:11 +02:00
#!/bin/sh
#
# requires <hashdeep>
if [ -r new_hashes.xml ]
then
2020-05-31 11:38:08 +02:00
echo "Found new_hashes.xml, renaming it to known_hashes.xml ..."
mv new_hashes.xml known_hashes.xml
2020-05-31 11:12:11 +02:00
fi
echo "Calculating new_hashes.xml of folder $1 ..."
hashdeep -c md5,sha1,sha256,tiger,whirlpool -r -d -l -j 1 $1 > new_hashes.xml
2020-05-31 11:38:08 +02:00
if [ -r known_hashes.xml ]
2020-05-31 11:12:11 +02:00
then
echo "This has changed:"
2020-05-31 11:38:08 +02:00
diff known_hashes.xml new_hashes.xml
2020-05-31 11:12:11 +02:00
fi
exit 0