bashcentosbatch-processingjpegoptim

How to run batch job for multiple extensions with find command?


I am trying to use jpegoptim for optimizing all jpg and jpeg images on my server recursively.

This command is working:

find . -type f -name "*.jpg"   -exec jpegoptim --strip-all {} \;

but i need something like this:

find . -type f -name "*.jpg" -or -name "*.jpeg"   -exec jpegoptim --strip-all {} \;

which is not working. Is there a way to do that ?


Solution

  • Try something like this:

    find . -type f \( -name "*.jpg" -o -name "*.jpeg" \) -exec jpegoptim --strip-all {} \;