Created
April 24, 2014 03:00
-
-
Save vphill/11239976 to your computer and use it in GitHub Desktop.
Bash script that takes a set of folders with a single pdf in each folder and creates the format used at UNT for importing into Aubrey
This file contains 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
for dirname in * | |
do | |
#echo moving into $dirname | |
cd "$dirname" | |
for pdf in *.pdf | |
do | |
#echo extract pages in $pdf | |
pagesfrompdf=`pdfinfo "$pdf" | grep -a "Pages:" | awk '{print $2}'` | |
echo $pagesfrompdf | |
pages=$(($(tr -d '\r' <<< $pagesfrompdf) - 1)) | |
#echo convert pdf to tiff | |
for i in `seq 0 $pages` | |
do | |
#echo page $i | |
convert -colorspace RGB -density 400x400 -quality 80 "$pdf"[$i] `printf "%05d.jpg" $i` | |
done | |
#echo make directories and move files | |
mkdir 01_jpg | |
mv *.jpg 01_jpg | |
mkdir 02_pdf | |
mv "$pdf" 02_pdf | |
echo $dirname finished | |
#find . -name "*.tif" -size -6000k | xargs -n 1 -P 3 mogrify -compress Group4 | |
done | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment