Skip to content

Instantly share code, notes, and snippets.

@justyns
Forked from addisonj/rm-corrupt.sh
Created August 19, 2014 15:40
Show Gist options
  • Save justyns/4ef54938e78b91847bd6 to your computer and use it in GitHub Desktop.
Save justyns/4ef54938e78b91847bd6 to your computer and use it in GitHub Desktop.
#!/bin/bash
matches=()
directory='/opt/graphite/storage/whisper'
for file in $(find $directory -type f -name '*.wsp' -print); do
$(python /usr/local/bin/whisper-info.py $file > /dev/null 2>&1)
retval=$?
echo "checking $file"
[ $retval -ne 0 ] && matches+=($file)
done
echo "deleting ${#matches[@]} corrupt files:"
for file in "${matches[@]}"; do
sudo rm $file && echo -e "- $file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment