Optimize Command Line Batch Processing Using the Find Command

Find All Jpegs
find ./ -iname '*.jpg'
Find and Optimize all Jpegs
find ./ -iname '*.jpg' -exec jpegoptim -p {} \;
Create Hidden File to Track Date
touch .jpeg_crush
Create Optimization Script
nano jpeg_crush.sh
#!/bin/bash
find ./ -newer .jpeg_crush -iname '*.jpg' -exec jpegoptim -p {} \;
touch .jpeg_crush

Type control-o, control-x to exit.

Make Script Executable
chmod +x jpeg_crush.sh
Run Jpeg Crush
./jpeg_crush.sh

Leave a comment

Your email address will not be published. Required fields are marked *