Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Pathfinder os.walk for humans

Project description

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

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pathfinder-0.5.3.tar.gz (4.0 kB) Copy SHA256 hash SHA256 Source None Nov 19, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page