[Unresolved] Spanning files larger than 2Gb

Jan 10, 2012 at 10:41 AM
Edited Jan 10, 2012 at 10:46 AM

Hi I am trying to write a spanned file that is larger than 2Gb. Can you give me code sample for that? When I use:

      using (ZipFile zip = new ZipFile())
          string[] files = Directory.GetFiles(@"MyDocuments\ProjectX");
          // add all those files to the ProjectX folder in the zip file
          zip.AddFiles(files, "ProjectX");
          zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G");
          zip.MaxOutputSegmentSize = 4 * 1024 * 1024 * 1024;   // 4Gb

than MaxOutputSegmentSize is obviously flowing over. But I've seen somewhere else that it is possible to write larger files on a 64Bit OS (with Ionic zip). Please give a sample for that and let me what useful limits there are?


Thanks a lot

Ps.: I'd like to give the end-user a choice of whether he wants to use a 3, 3.5, or 4Gb (variable) span size. Is it possible to define this beyond 2Gb? Under 2Gb everything's working smoothly with the above code...

Jan 10, 2012 at 11:06 PM

I think you need to enable Zip64 extensions.


I say "I think", because the zip64 limit is 4gb, not 2gb. 

You do not require a 64-bit OS to read or write zip64 archives using DotNetZip.


Jan 11, 2012 at 5:20 AM

Yes I have tried that too but I am still not able to specify a size of 3Gb because the MaxOutputSegmentSize parameter flows over (since it is an int).

Maybe I am getting the limits all wrong. Can you specify more precisely what these limits are? I expected to be able to choose a spanning size between a few Mb and whatever the maximum spanning size happens to be (say 4Gb).


In this post there is a statement that even larger files are no problem. Does this refer to the files being zipped (and not the zip container itself)?


In case this refers to the zip container: How can I produce such large files?

Thanks Dirk