This approach is the de-facto standard in several other languages and tools,
including Apache Ant and Maven, Ruby (Dir) and Perforce (…).

Python has built-in support for simple globs in fnmatcher and glob, but Formic:

Can recursively scan subdirectories

Matches arbitrary directories in the path (eg /1/**/2/**/3/**/*.py).

Has a high level interface:

Specify one or more globs to find files

Globs can be used to exclude files

Ant, and Formic, has a set of default excludes. These are files and
directories that, by default, are automatically excluded from all searches.
The majority of these are files and directories related to VCS (eg .svn
directories). Formic adds __pycache__.

Iterate through all matches in the sub-tree

Is more efficient with many common patterns; it runs relatively faster on
large directory trees with large numbers of files.

Quickstart

Formic can be installed from the Cheeseshop with easy_install or pip:

$ easy_install formic

Once installed, you can use Formic either from the command line:

$ formic -i "*.py" -e "__init__.py" "**/*test*/" "test_*"

This will search for files all Python files under the current directory
excluding all __init__.py files, any file in directories whose name contains
the word ‘test’, and any files that start test_.