Using find to locate files that match one of multiple patterns

Use -o, which means “or”:

find Documents \( -name "*.py" -o -name "*.html" \)

You’d need to build that command line programmatically, which isn’t that easy.

Are you using bash (or Cygwin on Windows)? If you are, you should be able to do this:

ls **/*.py **/*.html

which might be easier to build programmatically.

Leave a Comment