for i in "${args[@]}"; do
file_path=$(find -name "$1*" -type f);
if [ $file_path ]; then
echo $file_path;
echo "file_size before: $(du -sh $file_path)";
$(jpegoptim --strip-all --all-progressive -ptm 80 $file_path);
echo "file_size after: $(du -sh $file_path)";
fi
done
~/Downloads ⌚ 10:53:43
$ jpegoptim --strip-all --all-progressive -ptm 80 home.jpg
home.jpg 1920x720 24bit N JFIF [OK] 671034 --> 133789 bytes (80.06%), optimized.
Average compression (1 files): 80.06% (525k)
~/Downloads ⌚ 10:54:09
$ jpg_optim.sh home.jpg
./home.jpg
file_size before: 132K ./home.jpg
/home/serii/xubuntu/bin/jpg_optim.sh: line 14: ./home.jpg: Permission denied
file_size after: 132K ./home.jpg
~/Downloads ⌚ 10:54:21
$ ll
Permissions Size User Date Modified Name
.rw-rw-r-- 133k serii 7 Aug 10:53 home.jpg
jpg collection.jpg
collection.jpg 1920x3136 24bit P JFIF [OK] 466200 --> 466200 bytes (0.00%), skipped.
Average compression (1 files): 0.00% (0k)