[C#] Need help on Zipping contents of a list file (.lst)

Oct 16, 2012 at 6:24 PM
Edited Oct 16, 2012 at 6:30 PM

I have a .lst file that has the paths of various data that has to be zipped. The path may be a direct path to an executable or a path to a log file or may contain a wildcard like - c:\abc\*.exe. How do I zip all of them into a single zip file? Thanks

Contents of .lst file :

c:\log\abc.log

c:\log\def.log

c:\ping\*.bat

c:\ping\*.exe

This is what I tried:

using (ZipFile zip = new ZipFile()) 

 {                  

StreamReader file = File.OpenText("C:\\pingman\\pingzipA.lst");               

string read = String.Empty;
        while ((read = file.ReadLine()) != null)               

{                                       

zip.AddSelectedFiles(read, true);

                        zip.Save("c:\\update.zip");   

                }

         file.Close();

  }