FileFinder
Find files using a simple syntax.
FileFinder allows to specify the structure of filenames using a simple syntax. Parts of the file structure varying from file to file are indicated within named groups, similarly to a regular expression. Once setup, it can:
- Find corresponding files in a directory (and sub-directories)
- Parse values from the filenames
- Select only filenames with specific values or which pass filter functions
- Generate filenames
Quick examples
The following example will find all files with the structure Data/param_[parameter]/[year]/Temperature_[date].nc:
finder = Finder('/.../Data', 'param_%(parameter:fmt=.1f)/%(Y)/Temperature_%(Y)%(m)%(d).nc')
files = finder.get_files()
We can also select only some files, for instance only in january:
finder.fix_group('m', 1)
files = finder.get_files()
Or apply more complicated filters:
finder.fix_by_filters("m", lambda m: m % 2 == 0)
We can retrieve values from found files:
filename, matches = finder.files[0]
parameter = matches["parameter"]
# the date as a datetime object
date = matches.get_date()
And we can generate a filename with a set of parameters:
finder.make_filename(parameter=0.5, Y=2000, m=1, d=1)
# Specifying the month is optional since we already fixed it to 1.
Date as a special citizen: the "date" group name is (by default, but this can be deactivated) considered special in some operation, like fixing multiple groups from a datetime object, or having a filter opering on a full date:
finder.fix_group("date", datetime(2018, 2, 1))
finder.fix_by_filter("date", lambda d: d > datetime(2018, 2, 1))
Requirements
Python >= 3.10
Installation
From pip:
pip install filefinder
From source:
git clone https://github.com/Descanonge/filefinder.git
cd filefinder
pip install -e .
or
pip install -e https://github.com/Descanonge/filefinder.git#egg=filefinder
Documentation
Documentation is available at filefinder.readthedocs.io.
Metadata
Release files for filefinder 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| filefinder-1.3.1.tar.gz | 59.9 kB | With provenance | Details for filefinder-1.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| filefinder-1.3.1-py3-none-any.whl | Python 3 | none | any | Details for filefinder-1.3.1-py3-none-any.whl |
Total release size: 88.1 kB
Release files / filefinder-1.3.1.tar.gz
| Download URL | filefinder-1.3.1.tar.gz |
|---|---|
| Size | 59.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99373311f91de6f9edeb7e853e218afffa9a073487a421add16a8f1ff92fc69a
|
|
BLAKE2b-256 checksum How to use checksums |
e3373c770a15d3b73b8c1dda50fb1ddb5fb61b82d63a0491569bbf77fb0ec2d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 28, 2026.
Transparency logRelease files / filefinder-1.3.1-py3-none-any.whl
| Download URL | filefinder-1.3.1-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8a114d2ba7a55e42da15e1547c1cf10c57501d2f3e1ec6a66114cb38b0e6c40
|
|
BLAKE2b-256 checksum How to use checksums |
d276108ce7802100027ae1e160a54396321b854d6b065e99697f02a44a36555a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 28, 2026.
Transparency logSecurity for filefinder 1.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for filefinder-1.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.