extract_archive()¶
- audeer.extract_archive(archive, destination, *, keep_archive=True, verbose=False)[source]¶
Extract ZIP or TAR.GZ file.
- Parameters
- Return type
- Returns
paths of extracted files relative to
destintation
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.GZ fileRuntimeError – if
archive
is malformed
Examples
>>> _ = touch("a.txt") >>> create_archive(".", None, "archive.zip") >>> extract_archive("archive.zip", ".") ['a.txt'] >>> extract_archive("archive.zip", "sub") ['a.txt']