3

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?

Ernesto
  • 1,523
  • 1
  • 14
  • 32
julealgon
  • 7,072
  • 3
  • 32
  • 77
  • Did you ever resolve this? I am having a similar issue with version 2.1.1 of the PSCX Write-Zip cmdlet. When I try to append a file to an existing zip, I get an "**Extra data extended Zip64 information length is invalid**" error. (I'm using 2.1.1 because I'm writing PowerShell scripts for SQL Server 2012 agent jobs. Stuck with PowerShell 2.0) I saw in a C# forum that setting a parameter named UseZIP64 to OFF was the solution, but if that option exists in Write-Zip, it's buried in the module. – Michael McCormick Apr 13 '16 at 15:26
  • @MichaelMcCormick Nope. Last time I worked on it it was still a problem. We ended up not using it at all and relying upon the 7zip external executable. A shame really. I must say it's been a while since I've touched that code though (I'm on a different company now). – julealgon Apr 14 '16 at 15:13

0 Answers0