extract_file#
- extract_file(file_path: str | CloudPath | Path, output: str | CloudPath | Path, overwrite: bool = False) list | CloudPath | Path [source]#
Extract an archived file (zip or others). Overwrites if specified. For zipfiles, in case of multiple folders archived, pay attention that what is returned is the first folder.
- Parameters:
- Returns:
Extracted file paths (as str if only one)
- Return type:
Union[list, AnyPathType]
Example
>>> file_path = 'D:/path/to/zip.zip' >>> output = 'D:/path/to/output' >>> extract_file(file_path, output, overwrite=True) D:/path/to/output.zip'