expands an archive file, saving its content into the current directory.

ExtractArchive[file, dir]
saves the content of an archive file into directory dir.

ExtractArchive[file, dir, pattern]
extracts only files whose names match pattern.

Details and OptionsDetails 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.

ExamplesExamplesopen allclose all

Basic Examples (2)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
New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »