Don't generate two directories with same name on extract

  • Hans Schmidts
    Hans Schmidts

    Zip files come mainly in two variants: 1. Files and folders at top level (e.g. if you are inside some folder, select all and then add to zip) or 2. only one folder at top level (e.g. select one folder and add to zip). You must always know in advance which variant you have, because variant 1 most likely needs to be extracted to subfolder with same name as the zip file, but variant 2 to here. If you do it wrong you either get current directory littered up with the files form the zip file, or get one extra, unwanted, directory level (e.g. project1.7z gets extracted to D:\Projects\project1\procect1).

    Since I think that something like "D:\Projects\project1\procect1" is (almost) never really wanted, I suggest to simply extend the "extract to "name"":

    If the zip file contains only one directory at top level, and if that has the same name as the zip file, then automatically switch to "extract here" behaviour.

    You may want to introduce some switch to turn this off, or you may add an extra "extract automatic" command and context menu entry, but as stated above, I think that this is not needed.

    7-Zip 9.20