Corrupt PDFs

As a digital/media asset manager, corrupt files are the bane of my existence.

To programmatically find corrupt pdf files, I landed with the following utilizing pdftotext from xpdf.

for f in *.pdf; \
do pdftotext -q -f 1 -l 2 $f $f.txt; \
err=$?; \
if [ $err -ne 0 ]; then mv $f _failed_$f; \
elif [ $err -eq 3 ]; then mv $f _locked_$f; \
else rm $f.txt; fi;
done