Skip to content

extractEntryTo not preserving subdirectories as of 0.4.11 #306

Closed

Description

@keattang

Hi,

I recently upgraded from 0.4.10 to the latest (0.4.14) and found that extractEntryTo was no longer preserving subdirectories in my zip files. Instead it was unzipping everything into a flat folder.

To demonstrate this issue you can download any Github repository zip such as:
https://github.com/cthackers/adm-zip/archive/master.zip

These zip files contain a single top level entry which is a folder that contains the code. I want to unzip the contents of that folder into another folder. To do so I am doing this:

const AdmZip = require("adm-zip");

const zip = new AdmZip("/path/to/my/file.zip");

zip.extractEntryTo(zip.getEntries()[0], "myNewDirectory", false, true);

I expect myNewDirectory to hold the Github Repo code just as it looks in GitHub, but instead it contains no folders and every file is sitting flat inside myNewDirectory. This worked in 0.4.10 however when I tried rolling back versions I found it was broken in every version after 0.4.10.

Thanks for taking a look at this issue. Let me know if you need any more details.

Activity

  1. Scui1 commented on Mar 17, 2021

    @Scui1

    I noticed the same, any update on this?

  2. begin-again commented on Jun 18, 2025

    @begin-again

    I'm using 0.5.16 and find that an archive with a single folder is not preserved on extract. Instead its contents are dumped into the root. I have seen this on extract-zip package as well. I'm using this on windows

  3. cthackers commented on Jul 10, 2026

    @cthackers
    Owner

    fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions