Skip to content

ExcludeDir

Bases: BaseFileFilter, FrozenModel

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

.. versionadded:: 0.8.0 Replaces deprecated onetl.core.FileFilter

Parameters:

  • path (str | :obj:os.PathLike) –

    Path to directory which should be excluded.

Examples:

Create exclude dir filter:

.. code:: python

from onetl.file.filter import ExcludeDir

exclude_dir = ExcludeDir("/export/news_parse/exclude_dir")

match(path)

Returns True if path is matching the filter, False otherwise

.. versionadded:: 0.8.0

Examples:

>>> from onetl.impl import LocalPath
>>> filter.match(LocalPath("/path/to/file.csv"))
True
>>> filter.match(LocalPath("/path/to/excluded.csv"))
False
>>> filter.match(LocalPath("/path/to/file.csv"))
True