Compose Multi-volume Zip Archive
Overview
Aspose.ZIP for .NET allows you to create ZIP archives split into multiple files (volumes). The SaveSplit methdod s used to compose such multi-volume archives, making it easier to store and transfer large sets of data.
Options for split archive
The SplitArchiveSaveOptions constructor requires two parameter:
- The base file name for each segment
- The desired volume size in bytes All segments except the final one receive extensions like .z01, .z02, .z03, etc. The last segment uses the .zip extension. Typically, the final volume is smaller to accommodate any data that doesn’t exactly fill a complete segment.
Compose multi-volume archive
The following code example demonstrates how to create a split ZIP archive with parts of 65,536 bytes each (except possibly for the last one). The resulting files will be named part.z01, part.z02, part.z03, …, and part.zip:
1 FileInfo fi1 = new FileInfo("alice29.txt");
2 FileInfo fi2 = new FileInfo("picture.png");
3
4 using (SevenZipArchive archive = new SevenZipArchive(new SevenZipEntrySettings(new SevenZipPPMdCompressionSettings())))
5 {
6 archive.CreateEntry("alice29.txt", fi1);
7 archive.CreateEntry("picture.png", fi2);
8 archive.SaveSplit("C:\\Folder", new SplitSevenZipArchiveSaveOptions("part", 65536));
9 }Multi-volume ZIP archives support all standard encryption and compression methods available in regular ZIP archives.