I would like a program that:

  1. If top layer of archive is just single item, then extract here
  2. If top layer of archive is several items, then extract to new folder

I see these:

but I would like an open source solution if possible.


1 Answer 1


7-ZIP does this when using the Extract to.. menu option, is open source and supports a variety of archive formats.

I realize now that what you're actually asking is to ignore the intent of the root folder. An option like "Extract to this folder name" is predictable. There is a clear intent either to splurge the root into a folder vs always make sure there is a root folder. While "ignore root subfolder as long as its the only one" is not.

It is my opinion you will have a hard time finding an archiver that uses this logic.

  • The name of the archive is used as the folder name. It shows up in the menu as Extract to and then the name of the archive.
    – jdwolf
    Oct 15, 2017 at 6:33
  • Where to find it (your post misses a link)? And is it open source, as requested by OP? And does it really smartly decide by itself, as requested? According to the comment on this linked answer, it seems not.
    – Izzy
    Oct 15, 2017 at 9:47
  • It behaves exactly as I described. The answer you linked is about "Extract here" which explicitly means extract INTO this folder NOT make a subfolder. Therefor the expectation there is just wrong. If you ask 7-zip to create a folder with "Extract to [archive name]" it will create a folder with that name and extract the contents into it UNLESS there archive contains a single root folder with the same name as the archive in which it will extract the contents of that inner folder.
    – jdwolf
    Oct 15, 2017 at 10:07
  • If the archive contains a single FOLDER with the same NAME as the archive, then this solution works. but if it is a single FILE or single folder with a different NAME then his solutions fails
    – Zombo
    Oct 15, 2017 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.