walkmate

Traverse the file tree.


Keywords
filesystem, traverse, tree, walk
License
Other
Install
pip install walkmate==1.2.2

Documentation

Walkmate

Traverse the file tree.

Installation

pip install walkmate

Usage

Given a multi-level directory structure:

.
├── one.py
├── two.py
└── child
    └── three.py

We can list all the files tree:

>>> tree("test/fixtures")
["one.py", "two.py", "child/three.py"]

Filter with a regex:

>>> tree("test/fixtures", r"one\.py$")
["one.py"]

Add exlude patterns too:

>>> tree("test/fixtures", r"\.py$", [r"one\.py$"])
["two.py", "child/three.py"]

Specify the maximum depth:

>>> tree("test/fixtures", depth=1)
["one.py", "two.py"]