extract_archives()

audeer.extract_archives(archives, destination, *, keep_archive=True, verbose=False)[source]

Extract multiple ZIP or TAR.GZ archives at once.

Parameters
  • archives (Sequence[str]) – paths of ZIP or TAR.GZ files

  • 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 files 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 archives

Raises

Examples

>>> _ = touch("a.txt")
>>> create_archive(".", ["a.txt"], "archive.zip")
>>> _ = touch("b.txt")
>>> create_archive(".", ["b.txt"], "archive.tar.gz")
>>> extract_archives(["archive.zip", "archive.tar.gz"], ".")
['a.txt', 'b.txt']