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
destinationin order they were added to the archive- Raises
FileNotFoundError – if
archiveis not foundIsADirectoryError – if
archiveis a directoryNotADirectoryError – if
destinationis not a directoryRuntimeError – if
archiveis not a ZIP or TAR fileRuntimeError – if
archiveis 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']