Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

c# - .Net library for split volume zip files?

I need to create spanned (multi-volume) zip files using .Net, but I have been unable to find a library that enables me to do it.

Spanned zip is a zip compressed file that is split among a number of files, which usually have extensions like .z00, .z01, and so on.

The library would have to be open-source or free, because I'm gonna use it for a open source project.

(it's a duplicate to this question, but there are no answers there and I'm not going for ASP specific anyway)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

DotNetZip example:

int segmentsCreated ;
using (ZipFile zip = new ZipFile())
{
  zip.UseUnicode= true;  // utf-8
  zip.AddDirectory(@"MyDocumentsProjectX");
  zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G") ;
  zip.MaxOutputSegmentSize = 100*1024 ; // 100k segments
  zip.Save("MyFiles.zip");

  segmentsCreated = zip.NumberOfSegmentsForMostRecentSave ;
}

if segmentsCreated comes back as 5, then you have the following files, each not more than 100kb in size.

  • MyFiles.zip
  • MyFiles.z01
  • MyFiles.z02
  • MyFiles.z03
  • MyFiles.z04

Edited To Note: DotNetZip used to live at Codeplex. Codeplex has been shut down. The old archive is still [available at Codeplex][1]. It looks like the code has migrated to Github:



与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...