pathfinder is a Python module that makes os.walk usable.
Some examples
import pathfinder
# get all directories and sub-directories in current directory
paths = pathfinder.pathfind(".", just_dirs=True)
# get all files in the current directory and all sub-directories
paths = pathfinder.pathfind(".", just_files=True)
# get all jpg files using a regex
paths = pathfinder.pathfind(".", regex=".*\.jpg$")
# get all jpg files using posix wildcards
paths = pathfinder.pathfind(".", fnmatch="*.jpg")
# get all jpg files and png files
jpg_filter = pathfinder.FnmatchFilter("*.jpg")
png_filter = pathfinder.FnmatchFilter("*.png")
image_filter = pathfinder.OrFilter(jpg_filter, png_filter)
paths = pathfinder.pathfind(".", filter=image_filter)
The nuts and bolts
To grab the code, raise an issue or keep track of any updates visit the repository.
Product's homepage
Requirements:
· Python