Skip to main content

Scan a directory for files an apply callbacks on name matches

Project description

mfind

The mfind library allows to scan a directory for file an apply callbacks on file matches

How to install

pip install mfind

How to use

from mfind import MultiFinder

def internal_handler(filename: str):
    return False    # Just about all other handler checks


def html_handler(filename: str):
    print(f"Processing HTML file {filename}")


def mardkown_handler(filename: str):
    print(f"Processing markdown file {filename}")


file_processing_map = {
    "_*" : internal_handler,
    "*.html" : html_handler,
    "*.md" : mardkown_handler
}

mf = MultiFinder(file_processing_map)
mf.scan("test_dir", filename_only_match=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mfind-0.0.2.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

mfind-0.0.2-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page