extract_archive()

audeer.extract_archive(archive, destination, *, keep_archive=True, verbose=False)[source]

Extract ZIP or TAR.GZ file.

Parameters
  • archive (str) – path to ZIP or TAR.GZ file

  • destination (str) – folder where the files will be extracted. If the folder does not exists, it will be created

  • keep_archive (bool) – if False delete archive file after extraction

  • verbose (bool) – if True a progress bar is shown

Return type

List[str]

Returns

paths of extracted files relative to destintation in order they were added to the archive

Raises

Examples

>>> _ = touch("a.txt")
>>> create_archive(".", None, "archive.zip")
>>> extract_archive("archive.zip", ".")
['a.txt']
>>> extract_archive("archive.zip", "sub")
['a.txt']