The Compressed (zipped) Folder is invalid or corrupted

Mar 11, 2011 at 1:12 AM

First let me say I think this is a wonderful contribution to the .Net community.  Based on all the reviews I've read, I'm sure I'm just doing something wrong. 

 

My task is pretty simple.  I'm trying to compress up a directory structure and offload it to an amazon s3 repository for backup.  Everything appears to work, but when I try to open the compressed file, I get the following disheartening message (using the standard winzip utility):

 

"The Compressed (zipped) Folder is invalid or corrupted."

 

Now, I'm compressing somewhere in the family of 60,000 files into a resulting 11 GB file.  The code I'm using is relatively simple, but I just don't get why I can't open it. 

 Using zip As New ZipFile()
                    ' the Readme.txt file will not be password-protected.
                    zip.UseZip64WhenSaving = Zip64Option.AsNecessary
                    zip.AddEntry("Readme.txt", ReadmeText)
                    zip.AddSelectedFiles("(name != '*\.svn\*.*') and (name != *.zip) and (name != LogFailures.*)", FolderToZip, "", True)
                    zip.Save(ZipFileName)
End Using

 

I found a few articles that led me to believe that winzip wont open zip64 files, so I downloaded Cam Unzip (don't really know much about its reliability).  When I try to use it to open the compressed file, I get the following three responses:

"Warning - Error in zip structure"

"Error:  Warning - Error in zip structure!"

"A central header signature is wrong"

 

Any ideas why this might be happening?  I've got everything else working smoothly with regards to taking full and incremental backups as well as shipping the file off to s3.  This is the last part and I've been stuck for 2 weeks (off and on) on it.

Mar 11, 2011 at 1:14 AM

I'd also like to add that when I grab a smaller subset of my directory structure, everything proceeds smoothly and my compressed file is intact.  Could it be the shear size of the directory structure or the fact that the site is "live" while I'm performing the compression?

Coordinator
Mar 11, 2011 at 1:09 PM
Edited Mar 11, 2011 at 1:10 PM

Zip64 is supported by WinZip starting with Winzip v9.  If you have an older WinZip, then it will fail to open the archive and will complain about corruption in the archive. Windows Explorer will likewise complain about being unable to extract entries from a zip64 archive.  I have no idea about Cam Unzip, or whether it supports zip64.  I do know that there exist some tools that open zip64 files.  If you'd like to verify the file programmatically, of course you can use DotNetZip, and I believe you can also use the latest Perl IO::Uncompress::Unzip to do so.  

The DotNetZip Winforms tool will be able to open a valid zip64 archive.  The tool is downloadable in the utils package, available separately from the DotNetZip library, on the DotNetZip downloads page here on codeplex.

As I wrote in the documentation, The use of the ZIP64 extensions is optional and explicit in DotNetZip because, despite the status of ZIP64 as a bona fide standard, many other zip tools and libraries do not support ZIP64, and therefore a zip file with ZIP64 extensions may be unreadable by some of those other tools.

 

Mar 11, 2011 at 6:06 PM

Awesome!  That was it.  So everything has been working perfectly the whole time.  I was just getting a false negative from winzip.   Again, this is a great utility and your support of it is excellent.  Thanks for your time and commitment in make our lives so much easier.