extract_archives()

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

Extract multiple ZIP or TAR archives at once.

Parameters
  • archives (Sequence[str]) – paths of ZIP or TAR 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 destination in order they were added to the archives

Raises

Examples

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