0

I've just spent few hours struggling to do a very simple task: enumerate zip file contents using C# and System.IO.Compression. When I have zip files with small files inside, all is good. When i use a zip file of 1.2gb which has a database file inside 4.8Gb in size i get "Number of entries expected in End Of Central Directory does not correspond to number of entries in Central Directory." I've read and I've read a lot and i cant seem to find a way to work with my archive.

The code is:

string zipPath = @"E:\Path\Filename.zip";

        using (ZipArchive archive = ZipFile.OpenRead(zipPath))

       {
        foreach (ZipArchiveEntry entry in archive.Entries)
            { 
                Console.WriteLine(entry.FullName); 
            }
        }

Is there a way, any way, to use System.IO.Compression with large zip file contents? All I want is to enumerate the contents of the archive and I do not want to use any 3rd party bits as I was it was suggested on other places.

  • possible duplicate of [Can we ZIP/Unzip files larger than 4GB using .Net 4.5 libraries?](http://stackoverflow.com/questions/22641347/can-we-zip-unzip-files-larger-than-4gb-using-net-4-5-libraries) – Wai Ha Lee Mar 06 '15 at 00:23
  • A horrible hack, but if you **must** avoid 3rd party libraries, could you split the file into chunks (less than 4GB), zip then individually, then add those zip files to the larger zip file? That way you won't hit the 4GB barrier. – Wai Ha Lee Mar 06 '15 at 00:26
  • Unfortunately no, I cannot split those files :( – Flavius Florin Ilie Mar 06 '15 at 16:01

0 Answers0