[
  {
    "Id": "505540",
    "ThreadId": "230460",
    "Html": "<p>If i just do</p>\r\n<p>ICollection&lt;ZipEntry&gt; results = selector.SelectEntries(zip);</p>\r\n<p>I get all entries in the zip even entries that represent empty folders.&nbsp; Seems to me it's the equivalent of specifying a starting path of &quot;\\\\&quot; or root.&nbsp;</p>\r\n<p>But if I try to retrieve entries that represent empty folders _starting from a certain path in the archive_&nbsp; then it doesn't work.&nbsp; It works for *.* and returning file entries, but not directory entries.&nbsp; This seems like a bug to me.</p>\r\n<p><br>If I&nbsp; try something like</p>\r\n<p>ICollection&lt;ZipEntry&gt; results = selector.SelectEntries(zip, &quot;vehicles\\\\&quot;)</p>\r\n<p>where sub folder entities I expect to get back are</p>\r\n<p>vehicles\\\\cars</p>\r\n<p>vehicles\\\\airplanes</p>\r\n<p>vehicles\\\\trucks</p>\r\n<p>vehicles\\\\trains</p>\r\n<p>&nbsp;</p>\r\n<p>But none of the above sub entries are returned.</p>\r\n<p>Mike</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-10-11T11:43:31.07-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "505554",
    "ThreadId": "230460",
    "Html": "<p>I peeked at the code inside <span>FileSelector.SelectEntries&nbsp;</span> and i see why it doesnt work.</p>\r\n<p>instead ead of searching for the exact dir match you can just</p>\r\n<p>&nbsp;</p>\r\n<p>foreach (entry in zip.Entries)</p>\r\n<p>{</p>\r\n<p>&nbsp;&nbsp;&nbsp; string entryDir = Path.GetDirectoryName(entry.FileName);&nbsp; // let's say entry.FileName =&nbsp; &quot;vehicles/cars/&quot;&nbsp; then this will result in entryDir = &quot;vehicles\\\\cars&quot;</p>\r\n<p>&nbsp;&nbsp;&nbsp; if (entryDir != startPath &amp;&amp; startPath == Path.GetDirectoryName (entryDir))&nbsp; // second call of GetDirectoryName on entryDir strips off another dir layer so now we compare with startPath to know if this is a first level child under the startpath<br>&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; results.Add(entry);</p>\r\n<p>}</p>",
    "PostedDate": "2010-10-11T12:17:39.06-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "507002",
    "ThreadId": "230460",
    "Html": "<p>I didn't have the best understanding of the zip format in the beginning but now I understand how &quot;directories&quot; inside a zip work.&nbsp; For instance I was surprised to find that if you had an empty zip</p>\r\n<p>and you added an empty folder called \\\\vehicles\\\\cars</p>\r\n<p>and then a file \\\\vehicles\\\\cars\\\\viper.obj</p>\r\n<p>you'd have 2 zip entries.</p>\r\n<p>However again starting with an empty zip and this time only adding</p>\r\n<p>\\\\vehicles\\\\cars\\\\viper.obj</p>\r\n<p>would result in just one zip entry with no separate directory entry for&nbsp; \\\\vehicles\\\\cars\\\\&nbsp; in addition to the viper.obj&nbsp; entry.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-10-13T20:06:07.497-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "507418",
    "ThreadId": "230460",
    "Html": "<p>Yes, that's correct: directory entries within a zip file are not container objects. And, there's no requirement for a directory entry to exist in the zip, if a file object exists that would occupy that directory if extracted.</p>\r\n<p>So, give your new understanding, is there still a question, or a problem?</p>",
    "PostedDate": "2010-10-14T13:35:09.453-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]