A utility to find file paths.
Examples
from pathfinder import find
# get all directories and sub-directories in current directory
paths = find(".", just_dirs=True)
# get all files in the current directory and all sub-directories
paths = find(".", just_files=True)
# get all jpg files using a regex
paths = find(".", regex=".*\.jpg$")
# get all jpg files using posix wildcards
paths = find(".", fnmatch="*.jpg")
# get all jpg files and png files
from pathfinder import FnmatchFilter
from pathfinder import OrFilter
jpg_filter = FnmatchFilter("*.jpg")
png_filter = FnmatchFilter("*.png")
gif_filter = FnmatchFilter("*.gif")
image_filter = OrFilter(jpg_filter, png_filter, gif_filter)
paths = find(".", filter=image_filter)
# shortcut using bitwise or
paths = find(".", filter=jpg_filter | png_filter | gif_filter)
# even shorter using ImageFilter to find all images
from pathfinder import ImageFilter
paths = find(".", filter=ImageFilter())
# and an even shorter way
paths = ImageFilter().find(".")
Installation
To install pathfinder, simply:
$ pip install pathfinder
Development
To install development dependencies run:
$ pip install -r dev-requirements.txt
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pathfinder-0.5.4.tar.gz
(4.1 kB
view details)
File details
Details for the file pathfinder-0.5.4.tar.gz.
File metadata
- Download URL: pathfinder-0.5.4.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4222ae9a09c68c1736df57e09db523b65ba3b44dd3997563abf14997612dda9d
|
|
| MD5 |
1c432e21df4c3c62d38fb64229fc2584
|
|
| BLAKE2b-256 |
98e47d47e61a5746424817a78d6e602b74db4e30a56e4450abb394e1dc02c52c
|