Created
May 26, 2017 08:03
-
-
Save euperia/f9df2d36f26a999549e173245ea27a28 to your computer and use it in GitHub Desktop.
Remove files that are not what they appear to be
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Some image files were fetched from an URL and not validated. | |
# Hence we have files that have '.jpg' extensions but are actually HTML files. | |
# Clean these out | |
# Remove the `-i` from the `rm` if you don't want to manually confirm deletion | |
for f in `find ./ -type f -iname "*.jpg"`; | |
do | |
file "$f" | grep -q HTML | |
if [ $? -eq 0 ] ; then | |
echo "Deleting $f" | |
rm -i "$f" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment