Grimlockz
Grimlockz

Reputation: 2581

Script to search folders for OCR's PDFs

I've written a script to search through one folder to let me know what PDF has fonts (quick way to know if it's been OCR'd unless anyone knows of a better one)

What I can't do on my script is for it to search through all the folders within the main DIR?

Any thoughts?

!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
PDFDIR=/home/user/Temp/Docs/*.pdf
for f in $PDFDIR
do
echo "******************PDF***********************"
pdffonts $f
echo "$f"
echo "******************PDf***********************"
done > output.txt
# restore $IFS
IFS=$SAVEIFS 

Upvotes: 0

Views: 170

Answers (2)

Kevin
Kevin

Reputation: 56129

You'd do better to use find:

find /home/usr/Temp/Docs -name \*.pdf -exec echo "***PDF***" -print -exec pdffonts {} \; -exec echo "***END PDF***" \;

Upvotes: 2

Alex Howansky
Alex Howansky

Reputation: 53581

change this:

PDFDIR=/home/user/Temp/Docs/*.pdf
for f in $PDFDIR

to this:

PDFDIR=/home/user/Temp/Docs
for f in $(find $PDFDIR -type f -name "*.pdf")

Upvotes: 0

Related Questions