Error when extracting a 7zip archive to a specific output directory in Linux

13,032

Try this command instead (you can use 7z,7za or 7zr):

7z x -oextract/ foo.7z

According to the 7z manpage, there should be no space between the '-o' switch and the directory name:

  -o{Directory}
          Set Output directory



7z, 7za and 7zr :

7-Zip  is  a file archiver with the highest compression ratio. The pro‐
       gram supports 7z (that implements LZMA compression  algorithm),  LZMA2,
       XZ,  ZIP,  Zip64,  CAB,  RAR  (if  the  non-free  p7zip-rar  package is
       installed), ARJ, GZIP, BZIP2, TAR,  CPIO,  RPM,  ISO,  most  filesystem
       images  and  DEB  formats.  Compression  ratio  in the new 7z format is
       30-50% better than ratio in ZIP format.
  • 7z uses plugins to handle archives.
  • 7za is a stand-alone executable. 7za handles less archive formats than 7z.
  • 7zr is a stand-alone executable. 7zr handles less archive formats than 7z.
    7zr is a "light-version" of 7za that only handles 7z archives.
Share:
13,032

Related videos on Youtube

PeanutsMonkey
Author by

PeanutsMonkey

Updated on September 18, 2022

Comments

  • PeanutsMonkey
    PeanutsMonkey over 1 year

    I have a 7zip archive that I need to extract to another directory as opposed to the directory that the archive is located in however I get the error "Error:Incorrect command line". The command I am running is 7zr e -o extract/ {name_of_archive}.7z. What am I doing wrong?

    • Admin
      Admin almost 12 years
      7zr? Shouldn't that be 7za? Or am I being blond?
  • PeanutsMonkey
    PeanutsMonkey almost 12 years
    I don't have the command 7z however have 7zr. Does this mean I have to download a specific package and if so what? I am using Linux Ubuntu 12.04LTS
  • terdon
    terdon almost 12 years
    @PeanutsMonkey Look at my comment to your question. You can use 7zr, I've updated my answer to that effect.