[英]Ionic.Zip Splitt up zip can't be extracted
I zip a directory with Ionic.Zip and splitt it up into several files. 我用Ionic.Zip压缩一个目录并将其拆分成几个文件。 The result is a bunch of files named myfile.zip, myfile.z01, myfile.z02,...
结果是一堆名为myfile.zip,myfile.z01,myfile.z02,...的文件。
When I look into the zip-File with windows explorer, I can see the file list. 当我使用Windows资源管理器查看zip-File时,我可以看到文件列表。
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 但是当我尝试使用Windows资源管理器提取存档时,我收到一条消息相同的卷不能同时用作源和目标
When I open the zipfile with 7zip I get the message file myfile.zip cannot be opened as archive 当我用7zip打开zipfile时,我得到消息文件myfile.zip无法作为存档打开
Creating and extracting a single zip-archive works fine. 创建和提取单个zip-archive工作正常。
Here is the code, where I create the zip archive, using Ionic.Zip 这是代码,我使用Ionic.Zip创建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 :( 顺便说一句,我尝试了几种CompressionLevels,CompressionMethods的组合,有和没有密码,......没有变化:(
UPDATE 1: 更新1:
Unpacking works: 开箱工程:
using (ZipFile zip = ZipFile.Read(zipFilePath))
{
zip.Password = zipPassword;
zip.ExtractAll(targetDirectory, ExtractExistingFileAction.OverwriteSilently);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.