pymovements.utils.archives.extract_archive#

pymovements.utils.archives.extract_archive(source_path: Path, destination_path: Path | None = None, recursive: bool = True, remove_finished: bool = False, verbose: int = 1) Path[source]#

Extract an archive. The archive type and a possible compression is automatically detected from the file name. If the file is compressed but not an archive the call is dispatched to _decompress().

Parameters:
  • source_path (Path) – Path to the file to be extracted.

  • destination_path (Path, optional) – Path to the directory the file will be extracted to. If omitted, the directory of the file is used.

  • recursive (bool) – Recursively extract archives which are included in extracted archive.

  • remove_finished (bool) – If True, remove the file after the extraction.

  • verbose – Verbosity levels: (1) Print messages for extracting each dataset resource without printing messages for recursive archives. (2) Print additional messages for each recursive archive extract.

Returns:

Path to the directory the file was extracted to.

Return type:

Path