Find files filtered by multiple extensions
You can combine different search expressions with the logical operators -or
or -and
, so your case can be written as
find . -type f \( -name "*.shtml" -or -name "*.css" \)
This also show that you do not need to escape special shell characters when you use quotes.
Edit
Since -or
has lower precedence than the implied -and
between -type
and the first -name
put name part into parentheses as suggested by Chris.
Here is one way to do your first version:
find -type f -regex ".*/.*\.\(shtml\|css\)"
You need to parenthesize to only include files:
find . -type f \( -name "*.shtml" -o -name "*.css" \) -print
Bonus: this is POSIX-compliant syntax.