[
  {
    "Id": "678051",
    "ThreadId": "274211",
    "Html": "\r\n<p>Hi guys I'm using dotnetzip to gain how many files are within a zip the only problem is it also count the folders. How can I change it so it only counts .txt and .ini files or does'nt count folders.<br>\r\n<br>\r\nThanks Tom<br>\r\n<br>\r\nThe code so far is down below</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp; int count;<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using (ZipFile zip = ZipFile.Read(knowledgeplanning))<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; count = zip.Count;<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(count);</p>\r\n<p>&nbsp;</p>\r\n",
    "PostedDate": "2011-09-29T01:24:45.59-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "679173",
    "ThreadId": "274211",
    "Html": "<p>You'd have to iterate through the entries and examine each one. The way to determine if an entry is a folder or a file., is to check <a href=\"http://cheeso.members.winisp.net/DNZHelp/html/f15ba335-ba0f-adb9-74d0-87b8edcb1e82.htm\">the IsDirectory property on the ZipEntry</a>.</p>\r\n<p>The code might look like this:</p>\r\n<div style=\"color: black; background-color: white;\">\r\n<pre><span style=\"color: blue;\">int</span> count = 0;\r\n<span style=\"color: blue;\">using</span> (ZipFile zip = ZipFile.Read(archiveName)) \r\n{\r\n    <span style=\"color: blue;\">int</span> C = zip.Count; \r\n    <span style=\"color: blue;\">for</span>(<span style=\"color: blue;\">int</span> i=0, C = zip.Count; i &lt; C; i++) \r\n    {\r\n       ZipEntry e = zip[i];\r\n       <span style=\"color: blue;\">if</span> (!e.IsDirectory) count++;\r\n    }\r\n}\r\nConsole.WriteLine(<span style=\"color: #a31515;\">\"There are {0} file entries in the zip archive.\"</span>, count);\r\n</pre>\r\n</div>",
    "PostedDate": "2011-10-02T16:16:05.94-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]