Skip to main content

A utility to find file paths.

https://snyk.io/test/github/jkeyes/pathfinder/badge.svg

https://static.deepsource.io/deepsource-badge-light.svg

Examples

from pathfinder import find_paths

# get all directories and sub-directories in current directory
paths = find_paths(".", just_dirs=True)

# get all files in the current directory and all sub-directories
paths = find_paths(".", just_files=True)

# get all jpg files using a regex
paths = find_paths(".", regex=".*\.jpg$")

# get all jpg files using posix wildcards
paths = find_paths(".", 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_paths(".", filter=image_filter)

# shortcut using bitwise or
paths = find_paths(".", filter=jpg_filter | png_filter | gif_filter)

# even shorter using ImageFilter to find all images
from pathfinder import ImageFilter
paths = find_paths(".", 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-1.0.0.tar.gz (6.9 kB view details)

Uploaded Source

File details

Details for the file pathfinder-1.0.0.tar.gz.

File metadata

  • Download URL: pathfinder-1.0.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pathfinder-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f77d59f000353d328f5cbc45bb321ee5346b65e6ba1eeabf8d7adec06db1a809
MD5 6cb135a4c6ac06368ffbd3badcc07a38
BLAKE2b-256 6126de0e1202bf55bf60a3d924a09e64d2aad64e202b535743f1bdae4b9dbc95

See more details on using hashes here.

Supported by

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