解压缩大型 zip 文件的更快方法
a faster way of decompressing a large zip file
我正在编写一个从 zip 文件中提取图像并对其进行分类的程序。
System.IO.Compression.ZipFile.ExtractToDirectory
对于较小的文件似乎工作得很好,但对于 大文件 (>4GB) 来说真的很慢,那里有更快的库吗?我不需要任何特殊的东西,只需将 zip 文件解压到目录中即可。
使用 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);
}
我正在编写一个从 zip 文件中提取图像并对其进行分类的程序。
System.IO.Compression.ZipFile.ExtractToDirectory
对于较小的文件似乎工作得很好,但对于 大文件 (>4GB) 来说真的很慢,那里有更快的库吗?我不需要任何特殊的东西,只需将 zip 文件解压到目录中即可。
使用 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);
}