extract_file

Contents

extract_file#

extract_file(file_path: str | CloudPath | Path, output: str | CloudPath | Path, overwrite: bool = False) CloudPath | Path[source]#

Extract an archived file (zip or others). Overwrites if specified. If the archive don’t contain a root directory with the name of the archive without the extension, create it

Parameters:
  • file_path (str) – Archive file path

  • output (str) – Output where to put the extracted directory

  • overwrite (bool) – Overwrite found extracted directory

Returns:

Extracted directory paths

Return type:

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'