extract_archive()¶
- audeer.extract_archive(archive, destination, *, keep_archive=True, verbose=False)[source]¶
Extract ZIP or TAR file.
- Parameters
- Return type
- Returns
paths of extracted files relative to
destination
in order they were added to the archive- Raises
FileNotFoundError – if
archive
is not foundIsADirectoryError – if
archive
is a directoryNotADirectoryError – if
destination
is not a directoryRuntimeError – if
archive
is not a ZIP or TAR fileRuntimeError – if
archive
is malformed
Examples
>>> folder = audeer.path(".") >>> file = audeer.touch(folder, "a.txt") >>> archive = audeer.path("archive.zip") >>> audeer.create_archive(folder, None, archive) >>> audeer.extract_archive(archive, ".") ['a.txt'] >>> audeer.extract_archive(archive, "sub") ['a.txt']