Skip to content

Repository files navigation

pathfinder

A utility to find file paths.


Examples

frompathfinderimportfind_paths# get all directories and sub-directories in current directorypaths=find_paths(".", just_dirs=True)
# get all files in the current directory and all sub-directoriespaths=find_paths(".", just_files=True)
# get all jpg files using a regexpaths=find_paths(".", regex=".*\.jpg$")
# get all jpg files using posix wildcardspaths=find_paths(".", fnmatch="*.jpg")
# get all jpg files and png filesfrompathfinderimportFnmatchFilterfrompathfinderimportOrFilterjpg_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 orpaths=find_paths(".", filter=jpg_filter|png_filter|gif_filter)
# even shorter using ImageFilter to find all imagesfrompathfinderimportImageFilterpaths=find_paths(".", filter=ImageFilter())
# and an even shorter waypaths=ImageFilter().find(".")

Installation

To install pathfinder, simply:

$ pip install pathfinder

Development

To install development dependencies run:

$ pip install -r dev-requirements.txt

About

A python utility to find file paths.

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages