Created
September 19, 2023 14:58
-
-
Save kzndotsh/e06266fdc399dc72917e7723defeba8b to your computer and use it in GitHub Desktop.
find-corrupted-videos.sh
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 | |
root="." | |
filecount=$(find "$root" -type f | wc -l) | |
find "$root" -iname \*.avi -o -iname \*.mp4 -o -iname \*.mkv -o -iname \*.m4v -o -iname \*.wmv -o -iname \*.mov -o -iname \*.mpg -o -iname \*.mpeg -o -iname \*.wma -o -iname \*.asf -o -iname \*.asx -o -iname \*.rm -o -iname \*.3gp -o -iname \*.0gm | { | |
processed=0 | |
corrupt=0 | |
while read -r pathname | |
do | |
if ! ffprobe -v quiet -show_error -i "$pathname" | |
then | |
let ++corrupt | |
printf 'rm %q\n' "$pathname" >>deletions | |
fi | |
echo -n ' ' $((++processed)) / $filecount, $corrupt $'bad\r' | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment