RAR (.rar)

Background & Context

    • Registered MIME type: application/vnd.rar
    • 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.
    • Originally developed by Eugene Roshal in 1993.
    • RAR is an acronym for Roshal Archive.
    • Maintained by win.rar GmbH.


  • When importing files from a RAR archive, the specific converter for each format will be used.
  • Import["file.rar"] returns an expression of the form {"fn1", "fn2",}, giving full path specifications for all files in "file.rar".
  • Import["file.rar",elem] imports the specified element from a RAR file.
  • Import["file.rar","fn"] extracts "fn" from the archive and imports it.
  • Import["file.rar",{elem,suba,subb,}] imports a subelement.
  • Import["file.rar",{{elem1,elem2,}}] imports multiple elements.
  • Import["file","RAR"] or Import["file",{"RAR",elem,}] imports any file as a RAR archive.
  • See the following reference pages for full general information:
  • Importimport from a file
    CloudImportimport from a cloud object
    ImportStringimport from a string
    ImportByteArrayimport from a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • The following can be used to select or specify individual files in a RAR archive:
  • "FileNames"list of filenames representing the contents of a RAR 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 RAR format.
  • Import["file.rar","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.rar","*"] imports an entire archive.
  • Import["file.rar","dir/*.jpg"] imports all JPEG files from subdirectory dir.


open allclose all

Basic Examples  (1)

Importing a RAR 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 RAR archive:

Extract available elements for one of the files in the RAR archive:

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

Import the default element for multiple files with different formats: