Created
January 24, 2018 11:31
-
-
Save innermond/9046ff6710f47dd50c1e3c8fa77f7b63 to your computer and use it in GitHub Desktop.
Remove files that are not valid jpg
This file contains hidden or 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/bash | |
| # this script should be run by command: find . -type d -exec ./.remove-wrong-images {} \; | |
| if [ ! -d "$1" ]; then | |
| echo "need a directory" | |
| exit 1 | |
| fi | |
| cd "$1" | |
| for f in *.jpg; do | |
| [ -f "$f" ] || continue | |
| identify -- "$f" > /dev/null | |
| if [ $? -eq 1 ]; then | |
| echo "removing: $f" | |
| rm -- "$f" | |
| fi | |
| done | |
| cd - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment