Last active
August 29, 2015 14:20
-
-
Save pavgup/49009ebb3f083a4c44f7 to your computer and use it in GitHub Desktop.
This is a wee bit dangerous when used in isolation. It will search for all files that *nix believes is an image and will then use imagemin (npm install -g imagemin if you need it) to begin optimizing assuming the defaults are worth trusting. This is not lossless. It does make a backup of each file inside the current working directory inside, con…
This file contains 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/sh | |
mkdir backup; | |
for file in $( | |
find . -exec \ | |
file {} \; | \ | |
awk -F':' '{ if ($2 ~/[Ii]mage|EPS/) print $1,"\n"}'| \ | |
sed s/\.//); | |
do | |
cp -R -v .$file ./backup/; | |
imagemin .$file > .$file.tmp; | |
mv -f .$file.tmp .$file; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment