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

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


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


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

will work. There might be a more elegant way.


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.