Write-Zip throws exception on -Append

Topics: User Forum
Jan 21, 2013 at 6:46 PM

I'm developing a script to handle some backups by compressing several different directories, and I would like to put them all into the same .zip file.  The first Write-Zip creates the target file, and then successive calls use the -Append switch:

Write-Zip $SourceDir -IncludeEmptyDirectories -Append -OutputPath $Target

Each of these calls results in the following exception:

Write-Zip : Extra data extended Zip64 information length is invalid
At line:1 char:10
+ Write-Zip <<<< $SourceDir -IncludeEmptyDirectories -Append -OutputPath $Target
+ CategoryInfo : OpenError: (D:\Data\Data...21-11-14-17.zip:UnresolvedPscxPathImpl) [Write-Zip], ZipException
+ FullyQualifiedErrorId : ZipOpenFail,Pscx.Commands.IO.Compression.WriteZipCommand

Am I doing something wrong here? What do I check?


Thanks in advance!

Feb 8, 2013 at 12:43 AM
Did you have some news/solution?
I have the same issue.
Feb 9, 2013 at 2:21 AM
Well, I can duplicate the error. I'll try to take a look at it this weekend.
Aug 16, 2013 at 9:44 AM
Edited Aug 16, 2013 at 10:42 AM

I'm having a similar problem and wondered if there was a resolution?

As I proceed through each file with a foreach, at first the zip file doesn't exist, subsequect files are appended;

Write-Zip "$datfile" "$zipfile" -Quiet -FlattenPaths
Succeeds in writing file to zip

Write-Zip "$datfile" "$zipfile" -Append -FlattenPaths
Succeeds in writing file to zip but fails closing zip + FullyQualifiedErrorId : ZipCommitFail,Pscx.Commands.IO.Compression.WriteZipCommand

Write-Zip "$datfile" "$zipfile" -Append -FlattenPaths
Fails opening zip+ FullyQualifiedErrorId : ZipOpenFail,Pscx.Commands.IO.Compression.WriteZipCommand

Many thanks.
Oct 21, 2013 at 3:07 PM

I'm having a similar problem and wondered if there was a resolution?

Nov 1, 2013 at 5:20 PM
I'm having exactly the same error. Using the -Append switch appends the correct file but destroys the rest of the archive. Anyone found a solution as yet?
Mar 25, 2015 at 6:31 PM
I too am having this same type of issue with exactly what was described by decomeau above almost 18 months ago. The only major difference is am I am not using the -FlattenPaths command. The archive looks perfect, but when you try to unzip or append more files, it is all corrupted. Any updates or suggestions to solve the issue?
Jun 16, 2015 at 5:53 PM
Edited Jun 16, 2015 at 6:11 PM
I also have this issue and it looks like it will not be addressed any time soon. With a folder full of files to add to the archive I check for the presence of the ZIP file with Test-Path and if it is not there use

Write-Zip -Path $j -FlattenPaths -OutputPath $ZipFile

or if it does exist (after the first file) use

Write-Zip -Path $j -FlattenPaths -OutputPath $ZipFile -Append

The latter fails with

Write-Zip : Extra data extended Zip64 information length is invalid

It leaves me with a ZIp file that appears to have the first two files in it but cannot be extracted with 7zip (unsupported compression).

Looking for other (non pscx) solutions.
Edit: The Joel Bennett New-ZipFile function from http://ss64.com/ps/zip.html works well although seems slower,
New-ZipFile -ZipFilePath $ZipFile -InputObject $j -Append
Jul 29, 2015 at 7:41 PM
Sorry guys if you're having problems with this - I suspect there are bugs in the version of 7z.dll that I am linking the project with. We are moving to GitHub soon and with that, we'll be looking to overhaul a lot of this stuff. PSCX is one of the oldest community powershell libraries there is, and some of the cmdlets are showing their age.