Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description
files_finder -- Find files recursively
========================================


Introduction
------------

This package implements the `FilesFinder` class to simplify finding files
recursively from a specified directory. This class is easier to use, yet more
powerful than `os.walk`.

Examples
--------

Below is a few examples, for more ways to use `FilesFinder`, see the
samples directory.

Find all files:

from files_finder import FilesFinder
for filename in FilesFinder('.'):
print(filename)

Exclude a single pattern:

from files_finder import FilesFinder, wildcard
for filename in FilesFinder('.', exclude=wildcard('*.bak')):
print(filename)

Exclude more than one patterns:

from files_finder import FilesFinder, wildcard
for filename in FilesFinder('.', exclude=wildcard('*.bak', '*~')):
print(filename)

Only include files that match some patterns:

from files_finder import FilesFinder, wildcard
for filename in FilesFinder('.', include=wildcard('*.csv', '*.xml')):
print(filename)


FilesFinder Object
------------------

FilesFinder(root, exclude=None, include=None, recurse=True)

Creates a new `FilesFinder` object. The caller can loop
through the object to gain access to all the files found in the
`root` directory. See the Examples section.

`root` is a string representing the directory to search for files.

`exclude` is a function which takes in a path and returns a boolean
indicating if that path should be excluded from the results. The
default is None which means do not exclude any file. Note that the
`exclude` parameter has precedence over the `include` parameter.

`include` is a function which takes in a path and returns a boolean
indicating if that path should be included in the results.

`recurse` is a boolean indicating if `FilesFinder` should
search recursively. The default is True.
Release History

Release History

This version
History Node

1.0

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting