List Directories

Jan 21, 2009 at 1:15 PM

Is there any way to list the directories conatined in the zip file rather than every file?

Jan 21, 2009 at 3:40 PM
Use the IsDirectory property on the ZipEntry. For illustration, you could do something like this:
List<string>  GetContainedDirectories(string zipfile)
  List<string> list = new List<string>();
  using (ZipFile zip = ZipFile.Read("")) 
    foreach (ZipEntry e in zip) 
      if (e.IsDirectory) 
  return list;

If you prefer, you could start with the above, and using the .NET 3.5 capability, with slight mods, add this method as an extension method to the ZipFile class. See the wikipedia article for an overview on the how and why of extension methods.