I have a directory tree with many image files and I have to move then for another directory tree. But in this destiny directory my png files must be compressed.
For instance:
Soure directory tree:
./model/layout/img
./model/layout/img/log
./model/layout/img/errs
./model/layout/img/commons
(With many type of images files)
Destinty directorey tree:
./app/img
./app/img/log
./app/img/errs
./app/img/commons
Does anyone has solution for that?
I found a solution in this site. https://davidwalsh.name/pngcrush-directory.
I just have to modify a little bit the script.
#!/bin/sh
SRC_DIR=./model/layout/img/
DST_DIR=./app/img/
rm -rf $DST_DIR
cp -R $SRC_DIR $DST_DIR
for png in `find $DST_DIR -name "*.png"`;
do
echo "crushing $png"
pngcrush -reduce -brute "$png" temp.png
mv -f temp.png $png
done;