0

I created multipart zip file using DotNetZip library, following is the code used to create:

public Boolean CreateZip(string sourceFolder, string destinationZip)
        {
            Boolean isZipCreated = false;

            try
            {
                using (ZipFile zipObj=new ZipFile())
                {
                    if (File.Exists(destinationZip))
                    {
                        File.Delete(destinationZip);
                    }

                    zipObj.AddDirectory(sourceFolder);
                    zipObj.Encryption = EncryptionAlgorithm.WinZipAes256;
                    zipObj.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
                    zipObj.UseZip64WhenSaving = Zip64Option.Always;
                    zipObj.MaxOutputSegmentSize = 1024*1024*1024;
                    zipObj.Save(destinationZip);
                    isZipCreated = true;
                    Console.WriteLine("Number of Segments Created "+zipObj.NumberOfSegmentsForMostRecentSave);
                }
            }
            catch (Exception ex) 
            {
                Console.WriteLine("There is an exception inside Create zip method"+ex.Message+ex.StackTrace);
            }
            return isZipCreated;
        }

The size for each segment of zip file is 1 GB. The output files are generated as: file.zip, file.z01, file.z02, etc.

The question is:

How do I extract these files into one single output folder?

Following are the things I have tried:

I tried unzipping first file.zip file using WinRAR, a popup window comes to ask path for another file, but it only asks for one part and exits in error when file.zip and file.z01 are unzipped.

I tried using 7-zip it failed to unzip even the first file, i.e file.zip

  • Try commenting the Encryption, CompressionLevel, and UseZip64WhenSaving options to see if there's not one of those that's making the output non-standard. – jscarle May 15 '20 at 14:59
  • Also, according to the documentation https://documentation.help/DotNetZip/b2923f86-bc4a-7d64-381e-d7fbabdb5ed0.htm: "About interoperability: Split or spanned zip files produced by DotNetZip can be read by WinZip or PKZip, and vice-versa. Segmented zip files may not be readable by other tools, if those other tools don't support zip spanning or splitting. When in doubt, test. I don't believe Windows Explorer can extract a split archive." – jscarle May 15 '20 at 15:04
  • There are different version of the ZIP specification. Not all tools implement Optional features and not all tools support the new versions. So the issue may be with WinRaR. Try a different tool. – jdweng May 15 '20 at 15:23
  • Thanks for the suggestions, will check the documentation for more info – SSaurabhKKR May 15 '20 at 19:21
  • Finally found that WinZip works well for extracting these zip files, however, i created my own unzip windows form based application which uses DotNetZip to extract. – SSaurabhKKR May 16 '20 at 08:59

0 Answers0