我想解压一个Zip文件里一个tar.gz,但我不能解压.tar.gz解开与SharpZipLib
它显示了我的错误“找不到中央目录”,我不知道该怎么做。
首先,我在一个临时文件夹上解压缩zip,然后在该文件夹中搜索一个.tar.gz文件,然后尝试解压但是会崩溃,但是我可以用winrar应用程序打开.tar.gz文件一些文件夹和一些文件里面。
这是我的代码:
var trash = Path.Combine(_temporalPath, "Trash");
try
{
var zip = new FastZip();
Directory.CreateDirectory(trash);
zip.ExtractZip(_origin, trash, "");
var gzip = Directory.GetFiles(trash, "*.tar.gz")[0];
zip.ExtractZip(gzip, trash, FastZip.Overwrite.Always.ToString());
File.Delete(gzip);
}
catch (Exception)
{
//IGNORE
}
我查资料,但我只找到解压一个文件。 enter image description here
我需要的是打开tar.gz并从里面获取文件。
相关:http://stackoverflow.com/questions/24138373/unzip-gz-file-using-c-sharp –
在这个问题他们只解压缩一个文件不是一个组文件 –
这个FastZip怎么样:https://github.com/icsharpcode/SharpZipLib/wiki/FastZip –