Skip to content

compress-archive -update deletes an existing zip file if the -path spec returns 0 files #142

Open
@kaiser-roy

Description

@kaiser-roy

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

# make a tiny file
echo 'bibbity' > bibbity.txt

# this -path specification returns (at least) bibbity.txt and creates bobbity.zip
compress-archive -path bibbity.* -update -destinationpath bobbity.zip

# Now remove any such files
rm bibbity.*

# THIS path spec now returns nothing, and compress-archive actually deletes bobbity.zip!
compress-archive -path bibbity.* -update -destinationpath bobbity.zip

Expected behavior

The second call to compress-archive should leave the existing 'bobbity.zip' file undisturbed, but instead it completely removes it.

Actual behavior

'bobbity.zip' file is removed.

This is likely related to #112, though I think the use-case here is more general.

Error details

n/a

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.1682
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1682
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

5.1.19041.1682

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions