How to use find command to find all files with extensions from list?

I need to find all image files from directory (gif, png, jpg, jpeg).

find /path/to/ -name "*.jpg" > log

How to modify this string to find not only .jpg files?


Solution 1:

find /path/to -regex ".*\.\(jpg\|gif\|png\|jpeg\)" > log

Solution 2:

find /path/to/  \( -iname '*.gif' -o -iname '*.jpg' \) -print0

will work. There might be a more elegant way.

Solution 3:

find -E /path/to -regex ".*\.(jpg|gif|png|jpeg)" > log

The -E saves you from having to escape the parens and pipes in your regex.