C # Using 7zip to get a list of files in an archive?

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 found a search using 7zip help that you can use l instead of e (line 3) to list the contents of the archive, but I cannot figure out how to get the file names of the files contained in the archive. Any ideas? Thanks!

+4
source share
1 answer

You must use the 7zip SDK or SevenZipSharp .

To answer your question, set RedirectStandardOutput to true, then read t.Output .

+6
source

All Articles