Glob#

class onetl.file.filter.glob.Glob(pattern: str)#

Filter files or directories with path matching a glob expression.

Parameters:
patternstr

Pattern (e.g. *.csv) for which any file (only file) path should match

Examples

Create glob filter:

from onetl.file.filter import Glob

glob = Glob("*.csv")
match(path: PathProtocol) bool#

Returns True if path is matching the filter, False otherwise

Examples

from onetl.impl import LocalPath

assert filter.match(LocalPath("/path/to/file.csv"))
assert not filter.match(LocalPath("/path/to/excluded.csv"))
assert filter.match(LocalPath("/path/to/file.csv"))