walk_file_paths

pathwalker.walk_file_paths(root_path: Union[str, pathlib.Path], filter_pattern: Optional[str] = None, recursive: bool = False) Generator[pathlib.Path, None, None]

Yields only file paths.

Parameters
  • root_path (Path) – Root path to walk through.

  • filter_pattern (str) – Unix path pattern for filtering retrieved paths.

  • recursive(bool – Returns also paths of all sub folders.

Yields

Path

Examples

>>> from doctestprinter import doctest_iter_print
>>> from pathwalker import walk_file_paths
>>> found_files = sorted(
...     walk_file_paths("tests/.", filter_pattern = "[!._]*.py", recursive=True),
...     key=lambda x: str(x)
... )
>>> doctest_iter_print(found_files)
tests/path_test.py
tests/resources/foo.py
tests/test_common_paths.py