Skip to content

Instantly share code, notes, and snippets.

@devinberry
Created July 13, 2016 18:55
Show Gist options
  • Save devinberry/9378788dbdafb093306c92b2d77d3ac5 to your computer and use it in GitHub Desktop.
Save devinberry/9378788dbdafb093306c92b2d77d3ac5 to your computer and use it in GitHub Desktop.
Utility script to help aid in testing if movie files are corrupt enjoy ;)
#!/usr/bin/env bash
movieFileLocation="/Volumes/networkDriveLocation"
filecount=$(find "$movieFileLocation" -depth 0 -type f | wc -l)
find "$movieFileLocation" -depth 0 -type f -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" >> deletions2
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