Created
January 21, 2016 09:30
-
-
Save aminone/0dda8af839a7908a8f99 to your computer and use it in GitHub Desktop.
That is how I convert a bunch of jpg files to pdf
This file contains hidden or 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
#!/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