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 supports a variety of file compression formats, including ZIP, GZIP, TAR, and BZIP2.
  • ExtractArchive returns the names of the files and directories it created.
  • 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.
  • 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.
  • ExtractArchive[file] does not delete file.
  • ExtractArchive takes an option CreateIntermediateDirectories to specify whether intermediate directories should be created. The default setting is True.
  • ExtractArchive[File["file"],] and ExtractArchive[file,File["dir"],] are also supported.


open allclose all

Basic Examples  (2)

Uncompress a GZIP file, storing the result in the current directory:

Click for copyable input

Specify the destination directory:

Click for copyable input

Scope  (1)

Options  (1)

See Also

CreateArchive  Uncompress  Import  Export  FileSystemMap

Introduced in 2010