Skip to content

Instantly share code, notes, and snippets.

@aminone
Created January 21, 2016 09:30
Show Gist options
  • Save aminone/0dda8af839a7908a8f99 to your computer and use it in GitHub Desktop.
Save aminone/0dda8af839a7908a8f99 to your computer and use it in GitHub Desktop.
That is how I convert a bunch of jpg files to pdf
#!/bin/bash
START_TIME=$(date +%s)
echo
echo "Starting..."
echo
for dirName in */
do
( cd $dirName && echo "Generating pdf version of ${dirName%/}" && convert *.jpg ${dirName%/}.pdf )
done
echo
echo "Making result zip file..."
find . -iname "*.pdf" -print | zip documentsInPdfFormat.zip -@
echo
echo "Clearing the unnessery pdf files..."
find . -type f -iname "*.pdf" -exec rm -rf {} \;
END_TIME=$(date +%s)
DIFF=$(( $END_TIME - $START_TIME ))
echo
echo "That was it :)"
echo "It took just $DIFF seconds"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment