ExtractArchive
✖
ExtractArchive
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.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Uncompress a GZIP file, storing the result in the current directory:

https://wolfram.com/xid/0fq570ofdtfxa-18f1p


https://wolfram.com/xid/0fq570ofdtfxa-4k7zqb
Specify the destination directory:

https://wolfram.com/xid/0fq570ofdtfxa-eh034m


https://wolfram.com/xid/0fq570ofdtfxa-f7683
Scope (2)Survey of the scope of standard use cases
Create an archive from the ExampleData directory:

https://wolfram.com/xid/0fq570ofdtfxa-q9hbqs

Extract only JPEG files from the resulting archive:

https://wolfram.com/xid/0fq570ofdtfxa-z80t5e

Delete the resulting files and archive:

https://wolfram.com/xid/0fq570ofdtfxa-bmq3zf
Extract an archive from a URL:

https://wolfram.com/xid/0fq570ofdtfxa-602xd


https://wolfram.com/xid/0fq570ofdtfxa-g1036m
Options (4)Common values & functionality for each option
CreateIntermediateDirectories (2)
By default, intermediate directories are automatically created:

https://wolfram.com/xid/0fq570ofdtfxa-qgzlj6

https://wolfram.com/xid/0fq570ofdtfxa-2guvfv


https://wolfram.com/xid/0fq570ofdtfxa-whoo10
Prevent creation of intermediate directories to the destination path:

https://wolfram.com/xid/0fq570ofdtfxa-eslzo3


IgnoreCase (1)
Create an archive from the ExampleData directory:

https://wolfram.com/xid/0fq570ofdtfxa-xq2dlj

By default, ExtractArchive uses case sensitive patterns:

https://wolfram.com/xid/0fq570ofdtfxa-hsnypj

Use IgnoreCase -> True to treat lowercase and uppercase letters as equivalents:

https://wolfram.com/xid/0fq570ofdtfxa-zem1ir

Delete the resulting files and archive:

https://wolfram.com/xid/0fq570ofdtfxa-7yb60c
OverwriteTarget (1)

https://wolfram.com/xid/0fq570ofdtfxa-cly4eu

Extract only the JPEG files from the archive:

https://wolfram.com/xid/0fq570ofdtfxa-wanc6

Delete the first two extracted files:

https://wolfram.com/xid/0fq570ofdtfxa-kzg3ia
By default, ExtractArchive will not extract any contents if any destination files already exist:

https://wolfram.com/xid/0fq570ofdtfxa-lpm0k0





Use OverwriteTarget->Automatic to only extract files that do not already exist:

https://wolfram.com/xid/0fq570ofdtfxa-91a0j

Use OverwriteTarget->True to overwrite any existing files:

https://wolfram.com/xid/0fq570ofdtfxa-drwxuf

Properties & Relations (1)Properties of the function, and connections to other functions
CreateArchive creates a zip archive on the file system:

https://wolfram.com/xid/0fq570ofdtfxa-yl7kxk

ExtractArchive creates new files with the extracted contents, without reading the file into memory:

https://wolfram.com/xid/0fq570ofdtfxa-48ca3o

Import can be used to import a specific file from an archive directly into Wolfram Language:

https://wolfram.com/xid/0fq570ofdtfxa-7b6e4x
Wolfram Research (2010), ExtractArchive, Wolfram Language function, https://reference.wolfram.com/language/ref/ExtractArchive.html (updated 2020).
Text
Wolfram Research (2010), ExtractArchive, Wolfram Language function, https://reference.wolfram.com/language/ref/ExtractArchive.html (updated 2020).
Wolfram Research (2010), ExtractArchive, Wolfram Language function, https://reference.wolfram.com/language/ref/ExtractArchive.html (updated 2020).
CMS
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. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/ExtractArchive.html.
APA
Wolfram Language. (2010). ExtractArchive. Wolfram Language & System Documentation Center. Retrieved from 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
BibTeX
@misc{reference.wolfram_2025_extractarchive, author="Wolfram Research", title="{ExtractArchive}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/ExtractArchive.html}", note=[Accessed: 26-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_extractarchive, organization={Wolfram Research}, title={ExtractArchive}, year={2020}, url={https://reference.wolfram.com/language/ref/ExtractArchive.html}, note=[Accessed: 26-March-2025
]}