我想提取一个rar文件到一个位置。 问题是,rar文件包含4个文件夹,并且提取失败。 我需要将我rar中的所有文件和文件夹提取到位置文件夹。 并提取不存在的文件。如何在c#winform应用程序中提取包含多个文件夹的rar文件
我迄今所做的:
Process winrar = new Process();
winrar.StartInfo.FileName = WinrarPath + @"\unrar.exe";
winrar.StartInfo.CreateNoWindow = true;
winrar.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
winrar.EnableRaisingEvents = true;
winrar.ErrorDataReceived += new
DataReceivedEventHandler(winrar_ErrorDataReceived);
string src = downloadFilPath; // directory , not the file itself
string des = @"D:\"
winrar.StartInfo.Arguments = string.Format("x -o+ {0} {1}", src, des);
winrar.Start();
winrar.WaitForExit();
它的伟大工程,如果RAR文件只包含一个文件夹。 问题是一个rar文件包含多个文件夹。 也许它会帮助你为我的问题提供一个解决方案。
谢谢, Shuki
可能你可以简单地尝试先删除目标文件夹? – duDE 2013-04-22 14:48:27
如果您这样做,则不在档案中的文件将会消失。由于OP仅提到覆盖现有文件(与档案中的新对应文件),我不认为这是他想要的。 – Mels 2013-04-22 15:11:08
好的,我看,这是可能的 – duDE 2013-04-22 15:13:37