Pathlib's match(pattern) is documented as matching a path against a provided glob-style pattern but it doesn't work
>>> from pathlib import Path
>>> Path("w/x/y/z").mkdir(parents=True)
>>> list(Path().glob("w/**/z"))
[PosixPath('w/x/y/z')]
>>> Path("w/x/y/z").match("w/**/z")
False
Shouldn't that return true?
This feature has finally been added and recursive globs can be used in the full_match() method.
from pathlib import Path
Path("w/x/y/z").full_match("w/**/z")
# True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With