Skip to content

Instantly share code, notes, and snippets.

@officeokano
Created July 12, 2018 12:48
Show Gist options
  • Save officeokano/6b02f3778103e6128dad7c3bf3b94d67 to your computer and use it in GitHub Desktop.
Save officeokano/6b02f3778103e6128dad7c3bf3b94d67 to your computer and use it in GitHub Desktop.
if ls *.PNG > /dev/null 2>&1; then
printf "rename PNG to png\n"
rename 's/.PNG/.png/' *.png
fi
if ls *.png > /dev/null 2>&1; then
printf "convert png to jpg\n"
mogrify -format jpg -quality 95 *.png
archivename=`date "+%Y%m%d-%H%M-%S%N"`
printf "add original files to an archive $archivename.tar\n"
mkdir $archivename
mv *.png $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