Skip to content

Compress-Archive skips entry for top directory #101

@willportnoy

Description

@willportnoy

Steps to reproduce

Use PowerShell to make a zip file with a directory structure:

mkdir a
mkdir a\b
mkdir a\b\c
mkdir a\b\c\d
Compress-Archive a reproduction.zip

And then use a tool that will show the entries in the zip file.

$ unzip -l reproduction.zip
Archive:  reproduction.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2021-03-30 09:24   a/b/
        0  2021-03-30 09:24   a/b/c/
        0  2021-03-30 09:24   a/b/c/d/
---------                     -------
        0                     3 files

Expected behavior

I expect to see a separate line item for the "a" directory.

Actual behavior

I do not see a separate line item for the "a" directory.

This "invalid" zip archive breaks my eventual use case of MSDeploy addOnPackages within an ARM template.

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.0
PSEdition                      Core
GitCommitId                    7.1.0
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions