ExcludeDir#

class onetl.file.filter.exclude_dir.ExcludeDir(path: str | os.PathLike)#

Filter files or directories which are included in a specific directory.

Parameters:
pathstr or os.PathLike

Path to directory which should be excluded.

Examples

Create exclude dir filter:

from onetl.file.filter import ExcludeDir

exclude_dir = ExcludeDir("/export/news_parse/exclude_dir")
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"))