Skip to content

Instantly share code, notes, and snippets.

@jahed

jahed/find-tips.md

Last active May 6, 2020
Embed
What would you like to do?
Batch image optimisation.

Add -mtime -2 to limit files by last modified time. -2 to means "in the last 2*24 hours from now".

find . -type f -regex '.+\.jpg' -print0 | xargs -0 -L 1 -I % jpegtran -optimize -copy none -progressive -outfile '%' '%'
find . -type f -regex '.+\.png' -print0 | xargs -0 -L 1 -I % optipng -quiet -out '%' '%'
find . -type f -regex '.+\.png' -print0 | xargs -0 -L 1 -I % pngquant --speed 1 --ext '.png' --force '%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment