.. method:: Path.glob(pattern)
- Glob the given *pattern* in the directory represented by this path,
+ Glob the given relative *pattern* in the directory represented by this path,
yielding all matching files (of any kind)::
>>> sorted(Path('.').glob('*.py'))
.. method:: Path.rglob(pattern)
- This is like calling :meth:`Path.glob` with "``**``" added in front of the
- given *pattern*::
+ This is like calling :func:`Path.glob` with "``**/``" added in front of the
+ given relative *pattern*::
>>> sorted(Path().rglob("*.py"))
[PosixPath('build/lib/pathlib.py'),
def glob(self, pattern):
"""Iterate over this subtree and yield all existing files (of any
- kind, including directories) matching the given pattern.
+ kind, including directories) matching the given relative pattern.
"""
if not pattern:
raise ValueError("Unacceptable pattern: {!r}".format(pattern))
def rglob(self, pattern):
"""Recursively yield all existing files (of any kind, including
- directories) matching the given pattern, anywhere in this subtree.
+ directories) matching the given relative pattern, anywhere in
+ this subtree.
"""
pattern = self._flavour.casefold(pattern)
drv, root, pattern_parts = self._flavour.parse_parts((pattern,))