Skip to content
January 6, 2010 / kiranpatils

The Compressed (zipped) Folder is invalid or corrupted with SharpZipLib

I have generated Zip File using SharpZipLib. But when i try to access it using Windows XP extraction tool it shos following error:  Compressed (zipped) Folder is invalid or corrupted and it worked fine with 7zip. So, i did googling and found one nice solution from this link : http://blog.tylerholmes.com/2008/12/windows-xp-unzip-errors-with.html

Solution is — extracted from the above blog only.

...
ZipEntry entry = new ZipEntry(Path.GetFileName(sourceFilePath));
entry.DateTime = DateTime.Now;
/* By specifying a size, SharpZipLib will turn on/off UseZip64 based on the file sizes. If Zip64 is ON
* some legacy zip utilities (ie. Windows XP) who can't read Zip64 will be unable to unpack the archive.
* If Zip64 is OFF, zip archives will be unable to support files larger than 4GB. */
entry.Size = new FileInfo(sourceFilePath).Length;
zipStream.PutNextEntry(entry);
...

If it works say thanks to Tyler Holmes — Above Blog author, for such a nice article!

Happy zipping!

5 Comments

Leave a Comment
  1. bart / Jul 23 2010 12:07 pm

    It didn’t work, I tried everything. This looks like a bug

    • kiranpatils / Aug 8 2010 3:12 pm

      Can you pls post some code? Might be I can help you out in solving an issue.

      Happy Coding🙂

      Thanks,
      Kiran

  2. Marcel / Nov 17 2010 11:13 am

    Your Solution works fine!! Thank you very much.

  3. Tahir Taous / Jul 17 2012 4:55 am

    which software you arev using to unzip compressed folder. I had same error i was using 7zip tp extract files than i tried Winrar to unzip compressed folder and i successfully extracted files.
    Hope this will help.

Trackbacks

  1. Fix Sharpziplib Unzip Error Windows XP, Vista, 7, 8 [Solved]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: