7z (.7z)

Background & Context

    • Registered MIME type: application/x-7z-compressed
    • Data compression and archival format.
    • Used to reduce storage space and transfer times.
    • Binary format.
    • Can contain multiple files.
    • Supports a variety of compression methods.
    • Published by Igor Pavlov in 1999.

Import

  • When importing files from a 7z archive, the specific converter for each format will be used.
  • Import["file.7z"] returns an expression of the form {"fn1", "fn2",}, giving full path specifications for all files in "file.7z".
  • Import["file.7z",elem] imports the specified element from a 7z file.
  • Import["file.7z","fn"] extracts "fn" from the archive and imports it.
  • Import["file.7z",{elem,suba,subb,}] imports a subelement.
  • Import["file.7z",{{elem1,elem2,}}] imports multiple elements.
  • Import["file","7z"] or Import["file",{"7z",elem,}] imports any file as a 7z archive.
  • See the reference pages for full general information on Import.
  • ImportString supports 7z compression.

Import Elements

  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • The following can be used to select or specify individual files in a 7z archive:
  • "FileNames"list of filenames representing the contents of a 7z archive
    "filename"a single file
    "filename","format" a single file, taken to be in the specified format
    "filename","format",elemelement elem from the specified file
  • Import by default uses the "FileNames" element for the 7z format.
  • Import["file.7z","fn"] extracts and imports file "fn".
  • File names can include relative or absolute directory specifications and the abbreviated string patterns supported by StringMatchQ.
  • Import["file.7z","*"] imports an entire archive.
  • Import["file.7z","dir/*.jpg"] imports all JPEG files from subdirectory dir.

Examples

open allclose all

Basic Examples  (1)

Importing a 7z archive gives the names of the files in the archive by default:

Import all files using their default element:

Extract and import the GIF file:

Extract and import all GIF files:

Scope  (1)

Elements for a 7z archive:

Extract available elements for one of the files in the 7z archive:

Import some elements from one of the files in the archive:

Import the default element for multiple files with different formats: