I just downloaded the latest version of the PowerShell Community Extensions and I'm struggling to append files and folders to an existing zip file.
I'm running the PowerShell ISE to test the command, and I'm currently in my profile folder. Here is the folder structure I'm testing with:
- Users
|- MyUser
|- Tests
|- Container.zip
|- SomeFolder
|- file1.txt
|- file2.txt
My prompt is at the Users\MyUser\Tests
folder, and I'm running 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 whole structure, starting at Users
, like this:
- Container.zip
|- Users
|- MyUser
|- Tests
|- SomeFolder
|- file1.txt
|- file2.txt
But I want to have the SomeFolder
directly at the root of the zip file, like this:
- Container.zip
|- SomeFolder
|- file1.txt
|- file2.txt
The weird thing is that, if I remove the -Append
switch and let the cmdlet create a new zip, it then contains the expected structure. What am I missing?