expands an archive file, saving its content into the current directory.
saves the content of an archive file into directory dir.
extracts only files whose names match pattern.
Details and Options
- ExtractArchive can be used to extract files from an archive file, and returns the names of the files and directories it created.
- ExtractArchive supports a variety of file formats, including ZIP, TAR, GZIP, BZIP2, ZSTD, 7z, RAR and ISO.
- In ExtractArchive[source,…], source can be any of the following:
File["file"] or "file" file name, searched for on $Path URL["url"] or "url" HTTP, HTTPS or FTP URL
- By default, ExtractArchive saves the extracted content in the current working directory given by Directory.
- The archive to be extracted can be specified using a relative or absolute file specification.
- The destination directory can be given as a relative or absolute directory path.
- By default, if any file in the archive to be extracted already exists, ExtractArchive returns $Failed without creating any directories or files.
- Directories extracted by ExtractArchive may already exist.
- The following options can be given:
CreateIntermediateDirectories True whether to create intermediate directories IgnoreCase False whether pattern should be case sensitive OverwriteTarget False whether to overwrite existing files
- Possible settings for OverwriteTarget include:
False if any file from the archive already exists, do nothing and fail True overwrite any existing files Automatic only extract files that do not exist "KeepBoth" keep the existing file, automatically choosing a name for the new file
- ExtractArchive[url] accepts the following URLDownload options:
Authentication None authentication information to send CookieFunction Automatic function to apply to each cookie received ConnectionSettings Automatic speed and other settings for the connection FollowRedirects True whether to follow HTTP redirects Interactive True whether to allow interactive authentication dialogs TimeConstraint Infinity time to wait for a response VerifySecurityCertificates True whether to verify SSL security certificates
- ExtractArchive[source] does not delete source.
Examplesopen allclose all
Basic Examples (2)
By default, ExtractArchive will not extract any contents if any destination files already exist:
Wolfram Research (2010), ExtractArchive, Wolfram Language function, https://reference.wolfram.com/language/ref/ExtractArchive.html (updated 2020).
Wolfram Language. 2010. "ExtractArchive." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/ExtractArchive.html.
Wolfram Language. (2010). ExtractArchive. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ExtractArchive.html