Skip to content

Instantly share code, notes, and snippets.

@vcarel
Created August 19, 2013 23:10
Show Gist options
  • Save vcarel/6275281 to your computer and use it in GitHub Desktop.
Save vcarel/6275281 to your computer and use it in GitHub Desktop.
Shell script to generate a PDF file from a large amount of scanned pages.
cd pictures
FILES=$( find . -type f -name "*jpg" | sort -V )
mkdir temp && cd temp
for file in $FILES; do
BASE=$(echo $file | sed 's/.jpg//g');
convert ../$BASE.jpg $BASE.pdf;
done &&
pdftk *pdf cat output ../FINAL_NAME.pdf &&
cd ..
rm -rf temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment