I am using 7zip http://www.7-zip.org/download.html in a C# program to unzip files using the code below.
Process t = new Process();
t.StartInfo.FileName = "7za.exe";
t.StartInfo.Arguments = "e " + filePath[i] + " -y -o" + directory[3];
t.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
t.EnableRaisingEvents = true;
t.StartInfo.UseShellExecute = false;
l.StartInfo.RedirectStandardOutput = true;
t.Start();
Console.WriteLine(l.StandardOutput.ReadToEnd());
t.WaitForExit();
I have found searching through the 7zip help that it is possible to use l instead of e (line 3) to list the contents of the archive, but I can’t figure out how to get the file names of the files contained in the archive. Any ideas? Thanks!
You should use the 7zip SDK or SevenZipSharp.
To answer your question, set
RedirectStandardOutputto true, then readt.Output.