Skip to content

Instantly share code, notes, and snippets.

@aeakett
Created November 3, 2012 13:21
Show Gist options
  • Save aeakett/4007370 to your computer and use it in GitHub Desktop.
Save aeakett/4007370 to your computer and use it in GitHub Desktop.
optimize cbr and cbz files
# remove all the yucky characters from the file names and dump them in a dir
mmv '*.cbz' '#1.zip'
mmv '*.cbr' '#1.rar'
for i in *.zip; do mkdir $i.dir; unzip $i -d $i.dir; done
for i in *.rar; do mkdir $i.dir; unrar e $i $i.dir; done
# drag and drop all of the images into ImageOptim
# also check for extra pages with ads or other crap you don't need
for i in *.dir; do zip -9 $i.zip ./$i/*; done
mmv '*.*.dir.zip' '#1.cbz'
rm *.zip
rm *.rar
rm -r *.dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment