简体   繁体   中英

Ionic.Zip Splitt up zip can't be extracted

I zip a directory with Ionic.Zip and splitt it up into several files. The result is a bunch of files named myfile.zip, myfile.z01, myfile.z02,...

When I look into the zip-File with windows explorer, I can see the file list.

But when I try to extract the archive with windows explorer, I get a message The same volume can not be used as both the source and destination

When I open the zipfile with 7zip I get the message file myfile.zip cannot be opened as archive

Creating and extracting a single zip-archive works fine.

Here is the code, where I create the zip archive, using Ionic.Zip

using (ZipFile zip = new ZipFile())
{
    //zip.AlternateEncoding = System.Text.Encoding.UTF8;
    zip.AddDirectory(sourceDirectory);
    //zip.MaxOutputSegmentSize = 0; //Single file
    zip.MaxOutputSegmentSize = 1024 * 1024 * 8; //Splitt up into 8 MB pieces
    //zip.Password = zipPassword;
    zip.CompressionLevel = Ionic.Zlib.CompressionLevel.None;
    zip.CompressionMethod = CompressionMethod.None;

    zip.Save(zipFilePath);    

    segmentsCreated = zip.NumberOfSegmentsForMostRecentSave;
}

return segmentsCreated;

Btw, I tried several combinations of CompressionLevels, CompressionMethods, with and without password,... No changes :(

UPDATE 1:

Unpacking works:

using (ZipFile zip = ZipFile.Read(zipFilePath))
{
     zip.Password = zipPassword;
     zip.ExtractAll(targetDirectory, ExtractExistingFileAction.OverwriteSilently);
}

This is a known issue. you can't open a partial zip file using the windows explorer. Use WinRar .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM