#! /bin/sh
#this is where your files will be put
mkdir originals
# I run mozjpeg for everyfile in this dir, adding the suffix .tmp, and move the original file in /originals
for f in ./*.jpg;
do
mozjpeg -optimize -outfile $f.tmp $f;
mv $f originals/$f;
done
# fir evry .tmp i rename it without the extension,
for f in ./*.tmp;
do
mv $f "${f%.*}"
done