File and path utilities.
File utilities
File searching and path utilities.
- torch_tools.file_utils.ls_zipfile(zip_path: Path) List[Path] [source]
List the contents of
zip_path
.- Parameters:
zip_path (Path) – Path to the zipfile whose contents we want to list.
- Returns:
A list of the files in the zipfile at
zip_path
, sorted by file name.- Return type:
List[Path]
- Raises:
TypeError – If
zip_path
is not aPath
.
- torch_tools.file_utils.traverse_directory_tree(directory: Path) List[Path] [source]
Recursively list all files in
directory
.- Parameters:
directory (Path) – The directory whose contents should be searched.
- Returns:
A list of all of the files in
directory
, sorted by name.- Return type:
List[Path]
- Raises:
TypeError – If
directory
is not aPath
.FileNotFoundError – If
directory
does not exist.RuntimeError – If
directory
is not a directory.