Adding files and folders with PSCX Write-Zip does not respect folder structure

I just downloaded the latest PowerShell Community Extension and I am struggling to add files and folders to an existing zip file.

I run PowerShell ISE to test the command and I am currently in the profile folder. Here is the folder structure I'm testing with:

- Users
  |- MyUser
     |- Tests
        |- Container.zip
        |- SomeFolder
           |- file1.txt
           |- file2.txt

      

My prompt is in a folder Users\MyUser\Tests

and I run the following line:

dir SomeFolder | Write-Zip -OutputPath:Container.zip -Append

When I open the updated zip file, there is a folder for each folder of my entire structure, starting with Users

for example:

- Container.zip
  |- Users
     |- MyUser
        |- Tests
           |- SomeFolder
              |- file1.txt
              |- file2.txt

      

But I want to have the SomeFolder

zip file directly in the root directory, for example:

- Container.zip
  |- SomeFolder
     |- file1.txt
     |- file2.txt

      

The weird thing is that if I remove the switch -Append

and let the cmdlet create a new zip, it will contain the expected structure. What am I missing?

+3


source to share





All Articles