Filesystem operations

Filesystem-related operations.

morphocut.file.Find(root: str | Path | Variable[str | Path], extensions: Iterable, sort=False, verbose=False)[source]

Stream Find files under the specified directory.

Parameters:
  • root (str or Path, raw or Variable) – Root path where images should be found.

  • extensions (list, raw) – List of allowed extensions (including the leading dot).

  • sort (bool) – Sort results alphabetically (default false).

  • verbose (bool) – Print info about files (default false).

Returns:

Variable[str] – Path of the matching file.

morphocut.file.Glob(pathname: str | Variable[str], recursive: bool | Variable[bool] = False)[source]

Stream Find files matching pathname.

For more information see glob.

Parameters:
  • pathname (str or Variable[str]) – Pattern for path names containing a path specification. Can be either absolute (like /path/to/file) or relative (like ../../foo/*/*.bar) and can contain shell-style wildcards. If the pattern is followed by an os.sep or os.altsep then files will not match.

  • recursive (bool or Variable[bool]) – If true, the pattern “**” will match any files and zero or more directories, subdirectories and symbolic links to directories.

Returns:

Variable[str] – Path matching pathname.