I am having difficult unpacking a zip to a specific directory. I am trying to get all contents of subdirectory of the zipped file and not the parent directory. This is parent directory within zip file;


However I want the directories below and was trying to extract with the following command;

7z e mongodb-win32-x86_64-2008plus-2.6.0.zip –o”c:\program files\mongodb” -r

I keep getting cannot find archive, I have tried various variations of syntax including dropping quotes, etc.

Any help would be greatly appreciated!

  • what is the archive's filename?
    – Jasper
    Apr 17, 2014 at 10:06
  • mongodb-win32-x86_64-2008plus-2.6.0.zip
    – user316298
    Apr 17, 2014 at 12:14

1 Answer 1


The man page tells you to put the options first, and

          Recurse subdirectories
          (CAUTION: this flag does not do what you think, avoid using it)

You can do eiter

7z x -o"somedir" mongodb-win32-x86_64-2008plus-2.6.0.zip

to extract the contents of mongodb-win32-x86_64-2008plus-2.6.0.zip to the -output directory "somedir", preserving the internal directory structure of the archive.


7z e -o"somedir" mongodb-win32-x86_64-2008plus-2.6.0.zip

to extract every file in the archive to "somedir" while flattening the archive, so every file will be saved in "somedir", regardless of the directory structure in the archive. Since your archive contains only one subdirectory with text files, this will come closest to your needs.

  • Ok thanks Jasper however the directory it creates is called "mongodb-win32-x86_64-2008plus-2.6.0" which contains a subdirectory "mongodb" however I need this subdirectory to be the one 7zip extracts and not the parent one.
    – user316298
    Apr 17, 2014 at 12:33
  • Please povide a link to the zip file.
    – Jasper
    Apr 18, 2014 at 10:13
  • fastdl.mongodb.org/win32/…
    – user316298
    Apr 19, 2014 at 11:23
  • The e approach was almost correct then, except the -r and the option at the end. See updated answer.
    – Jasper
    Apr 21, 2014 at 19:02
  • Thanks Jasper for the answer however when running a batch file it won't allow me to goto next command after unzip process, I will ask another question on their forum at SourceForge for an anwser.
    – user316298
    Apr 22, 2014 at 10:55

You must log in to answer this question.