pymovements.utils.paths.match_filepaths#
- pymovements.utils.paths.match_filepaths(path: str | Path, regex: re.Pattern, relative: bool = True, relative_anchor: Path | None = None) list[dict[str, str]] #
Traverse path and match regular expression.
- Parameters:
path (str | Path) – Root path to be traversed.
regex (re.Pattern) – Regular expression filenames will be matched against.
relative (bool) – If True, specify filepath as relative to root path. (default: True)
relative_anchor (Path | None) – Specifies root path in case of
relative == True
. If None,path
will be chosen as relative_anchor for recursive calls. (default: None)
- Returns:
Each entry contains the match group dictionary of the regular expression.
- Return type:
list[dict[str, str]]
- Raises:
ValueError – If
path
does not point to a directory.