Skip to content

Instantly share code, notes, and snippets.

@stojg stojg/rm-corrupt.sh forked from codepunkt/rm-corrupt.sh
Last active Oct 4, 2016

Embed
What would you like to do?
find/delete corrupt whisper-files
#!/bin/bash
options=('find' 'delete')
PS3='state your wish: '
echo -e "\nfind/delete corrupt whisper-files"
select opt in "${options[@]}"; do
case $REPLY in
[12] ) option=$opt; break;;
* ) exit;;
esac
done
if [ $option ]; then
matches=()
directory='/var/graphite/'
for file in $(find $directory -type f -name '*.wsp' -print); do
/usr/local/bin/whisper-info.py "$file" > /dev/null 2>&1
retval=$?
if [ $retval -ne 0 ]; then
printf "\r\033[Kcorrupt $file\n"
if [ $option == 'delete' ]; then
find "$file" -type f -delete
fi
else
echo -ne "\r\033[Kchecked $file"
fi
done
fi
echo "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.