Skip to content

Instantly share code, notes, and snippets.

@officeokano
Last active July 12, 2018 13:14
Show Gist options
  • Save officeokano/a57fb6a360e85e25310aca55f3022c84 to your computer and use it in GitHub Desktop.
Save officeokano/a57fb6a360e85e25310aca55f3022c84 to your computer and use it in GitHub Desktop.
if ls *.JPG > /dev/null 2>&1; then
printf "rename JPG to jpg\n"
rename 's/.JPG/.jpeg/' *.JPG
rename 's/.jpeg/.jpg/' *.jpeg
# rename 'y/A-Z/a-z/' *.JPG
fi
if ls *.jpg > /dev/null 2>&1; then
printf "convert jpg to pdf\n"
mogrify -format pdf -density 100 -geometry 1170x1170 -quality 75 *.jpg
archivename=`date "+%Y%m%d-%H%M-%S%N"`
printf "add original files to an archive $archivename.tar\n"
mkdir $archivename
mv *.jpg $archivename/
tar uvf $archivename.tar $archivename
printf "remove original files\n"
rm -r $archivename
printf "done\n"
else
printf "nothing to do\n"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment