Skip to content

Instantly share code, notes, and snippets.

@dwburke
Last active April 9, 2026 20:45
Show Gist options
  • Select an option

  • Save dwburke/ca3f76667077cc4c12329ea9721b7638 to your computer and use it in GitHub Desktop.

Select an option

Save dwburke/ca3f76667077cc4c12329ea9721b7638 to your computer and use it in GitHub Desktop.
batchverify.sh
#!/opt/bin/bash
set -e
OIFS="$IFS"
IFS=$'\n'
list=$(find . -type f | sort)
#list=$(find . -type f | shuf)
numleft=$(echo "$list" | wc -l)
echo "$numleft original files left"
for file in $list ; do
ending=$(echo "$file" | sed 's/\(.*\)\.\(.*\)$/\2/')
#include this block if you want to have 20% recovery data
if [ -e "$file-20p.par2" ] && [ "$ending" != "par2" ] && [ "$(stat --format=%s "$file")" != 0 ]; then
echo "$numleft original files left"
par2verify -q -a "$file-20p.par2" $file
fi
#include this block if you want to have 100% recovery data
#if [ ! -e "$file-100p.par2" ] && [ "$ending" != "par2" ] && [ "$ending" != "sig" ] && [ "$(stat --format=%s "$file")" != 0 ]; then
#echo "$numleft original files left"
#par2create -q -n1 -r100 "$file"
#rm "$file".par2
#mv "$file".vol*par2 "$file"-100p.par2
#fi
#include this block if you want to check for normal AND cryptographic integrity
#if [ ! -e "$file.sig" ] && [ "$ending" != "par2" ] && [ "$ending" != "sig" ]; then
#gpg --default-key C0FFEEBEEFC0FFEEBEEFC0FFEEDEADBEEF31415926 --detach-sign --yes "$file"
#fi
numleft=$((numleft-1))
done
IFS="$OIFS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment