Skip to content

Instantly share code, notes, and snippets.

@abrad1212
Created June 25, 2017 21:08
Show Gist options
  • Save abrad1212/078983161ebfa717530908e2fd0d386d to your computer and use it in GitHub Desktop.
Save abrad1212/078983161ebfa717530908e2fd0d386d to your computer and use it in GitHub Desktop.
Check to see if JPEGs are corrupted.
#!/bin/bash
# Usage
# bash badjpegs.sh Cats/ > errors.txt
# Then check errors.txt for the bad JPEGs
find $1 -name '*.jpg' | while read FILE; do
if [[ $(identify -format '%f' "$FILE" 2>/dev/null) != $FILE ]]; then
echo "$FILE"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment