From: David Neary (dneary at domain wanadoo.fr)
Date: Thu 04 Jul 2002 - 16:00:39 IST
Justin MacCarthy wrote:
> Hi,
>
> Does anyone know [can you / how to ] check 100's of PDF files with
> ghostscript to make sure they are valid PDFs???
The first four characters of a valid PDF are %PDF. Is that a good
enough check? You may get a rare false negative... if it's good
enough, then this'll do...
#!/bin/sh
for i in $*; do
read -n 4 BUFFER < $i;
if [ x$BUFFER = 'x%PDF' ]; then
echo $i looks like it might be a PDF
fi
done
Dave.
--
David Neary,
Marseille, France
E-Mail: bolsh at domain gimp.org
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:40 GMT