Skip to main content
https://travis-ci.org/jkeyes/pathfinder.png?branch=master

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

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.2.tar.gz (4.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: pathfinder-0.5.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pathfinder-0.5.2.tar.gz
Algorithm Hash digest
SHA256 64774a2bca2a4e32898b5022caaafcf8d85a3e670caea5451b54c3aab3616b3d
MD5 4682871d9e35801cb9c4fb25165ce8fd
BLAKE2b-256 b5ab8e550927c71612174dbb1603e90e22bb2bae6a8557124ede10ae0de3b926

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 Sentry Error logging StatusPage Status page