解压缩大型zip文件的更快方法

时间:2015-11-03 14:47:58

标签: c# .net zip

我正在编写一个程序,从zip文件中提取图像并对其进行编目。

System.IO.Compression.ZipFile.ExtractToDirectory似乎适用于较小的文件,但对于大文件(> 4GB)来说真的很慢,那里有更快的库吗?我不需要任何特殊的东西只是将zip文件解压缩到一个目录中。

1 个答案:

答案 0 :(得分:0)

使用7-zip http://www.7-zip.org/download.html

    public static string[] UnpackZip(string file, string targetDirectory)
    {
        Process p = new Process();
        string unzip = "x -y \"-o" + targetDirectory + "\" \"" + file + "\" ";
        p.StartInfo.FileName = "7z.exe";
        p.StartInfo.Arguments = unzip;
        p.Start();
        p.WaitForExit();
        if (p.ExitCode != 0)
            throw new Exception("Errore durante l'unzip " + p.ExitCode + " - " + unzip);
        return Directory.GetFiles(targetDirectory);
    }