extract_archives()¶
- audeer.extract_archives(archives, destination, *, keep_archive=True, verbose=False)[source]¶
Extract multiple ZIP or TAR archives at once.
- Parameters
- Return type
- Returns
paths of extracted files relative to
destination
in order they were added to the archives- Raises
FileNotFoundError – if an archive is not found
IsADirectoryError – if an archive is a directory
NotADirectoryError – if
destination
is not a directoryRuntimeError – if an archive is not a ZIP or TAR file
RuntimeError – if an archive file is malformed
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']