datalad_next.iter_collections.iter_dir
- datalad_next.iter_collections.iter_dir(path: Path, *, fp: bool = False) Generator[DirectoryItem, None, None][source]
Uses
Path.iterdir()to iterate over a directory and reports contentThe iterator produces an
DirectoryIteminstance with standard information on file system elements, such assize, ormtime.In addition to a plain
Path.iterdir()the report includes a path-type label (distinguished arefile,directory,symlink).- Parameters:
path (Path) -- Path of the directory to report content for (iterate over).
fp (bool, optional) -- If
True, each file-type item includes a file-like object to access the file's content. This file handle will be closed automatically when the next item is yielded.
- Yields:
DirectoryItem-- Thenameattribute of an item is aPathinstance, with the format matching the mainpathargument. When an absolutepathis given, item names are absolute paths too. When a relative path is given, it is relative to CWD, and items names are relative paths (relative to CWD) too.