解压缩大型 zip 文件的更快方法 [英] a faster way of decompressing a large zip file
本文介绍了解压缩大型 zip 文件的更快方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个从 zip 文件中提取图像并对其进行编目的程序.
I am writing a program that extracts images from zip file and catalogues them.
System.IO.Compression.ZipFile.ExtractToDirectory
似乎适用于较小的文件,但对于大文件(>4GB)来说真的很慢,有没有有更快的图书馆吗?我不需要任何特殊的东西来将 zip 文件解压缩到一个目录中.
System.IO.Compression.ZipFile.ExtractToDirectory
seems to work fine for smaller files but it is really really slow for big files (>4GB), is there a faster library out there? I don't need anything special just to extract the zip file into a directory.
推荐答案
使用 7-ziphttp://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 文件的更快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文