Syntax for find on Mac OS X
- by hekevintran
I have a project directory that contains source code and subdirectories of source code. I want to use the Unix program find to search recursively for the names of files of certain extensions. The versions of find on Linux and Mac OS X behave differently.
# Works in Linux
find . -type f -regex ".*\.\(py\|html\)$"
# Neither of these works in Mac OS X
find . -type f -regex ".*\.\(py\|html\)$"
find . -type f -regex ".*\.(py|html)$"
How do I write this command so that it will run on Mac OS X (and hopefully on Linux too)?