Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

find all jpg and png at the same time

Tags:

bash

shell

So I want to resize all jpg and png in 1 script

here is what is currently using, is there any way to run this for jpg and png at the same time?

  find file/path -type f -name '*.PNG' -exec sips -Z 800 -s formatOptions  60 {} \;
like image 820
Justin Avatar asked Dec 08 '25 06:12

Justin


1 Answers

"How to make find find files based on two different patterns": the -o ("or") option.

find file/path -type f \( -name '*.PNG' -o -name '*.JPG' \) -exec ...

Note that your question should have been phrased like that, as it has nothing to do with sips in particular.

Note that you can use -iname for case-insensitive matching, in case not all your file extensions are uppercase.

like image 151
DevSolar Avatar answered Dec 09 '25 23:12

DevSolar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!