[
  {
    "Id": "221464",
    "ThreadId": "65031",
    "Html": "<p>I'm using this library and have been very impressed by its functionality, everything has been working great until someone uploaded a zip file that was created using a Mac. For some reason there is an added __MACOSX folder in there which is causing problems in my application. What I want to do is only process files that are in the root of the zip file, any directories and any files within them should be ignored. Is there a built-in way of doing this or would I need to do some processing myself?</p>\r\n<p>Thanks for any help</p>",
    "PostedDate": "2009-08-10T03:53:58.46-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "221748",
    "ThreadId": "65031",
    "Html": "<p>I don't know exactly what you mean by &quot;process files that are in the root of the zip file&quot;.</p>\r\n<p>You can select entries to extract using LINQ (See examples for <a href=\"http://dotnetzip.codeplex.com/Wiki/View.aspx?title=DotNetZip-Linq-Csharp&referringTitle=Home\">C#</a> or <a href=\"http://dotnetzip.codeplex.com/Wiki/View.aspx?title=DotNetZip-LINQ-VB&referringTitle=Home\">VB</a>), or using the&nbsp;ZipFile.SelectEntries() method.</p>\r\n<p>Example using LINQ to select files in C#:</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>Console.WriteLine(<span style=\"color:#A31515\">&quot;\\n\\nOnly those entries in the 'root':\\n&quot;</span> + divider);\r\n<span style=\"color:Blue\">using</span> (<span style=\"color:Blue\">var</span> zip = ZipFile.Read(_archiveToRead))\r\n{\r\n    <span style=\"color:Blue\">var</span> selection = <span style=\"color:Blue\">from</span> e <span style=\"color:Blue\">in</span> zip.Entries\r\n        <span style=\"color:Blue\">where</span> !e.FileName.Contains(<span style=\"color:#A31515\">&quot;/&quot;</span>)\r\n        <span style=\"color:Blue\">select</span> e;\r\n\r\n    <span style=\"color:Blue\">foreach</span> (<span style=\"color:Blue\">var</span> e <span style=\"color:Blue\">in</span> selection)\r\n    {\r\n        Console.WriteLine(e.FileName);\r\n        e.Extract(_extractDir, overwrite);\r\n    }\r\n}\r\n</pre>\r\n</div>\r\n<p>&nbsp;</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>Console.WriteLine(<span style=\"color:#A31515\">&quot;\\n\\nOnly those entries from the root (method #2):\\n&quot;</span> + divider);\r\n<span style=\"color:Blue\">using</span> (<span style=\"color:Blue\">var</span> zip = ZipFile.Read(_archiveToRead))\r\n{\r\n    <span style=\"color:Green\">// select all zip entries in the &quot;root&quot; directory</span>\r\n    <span style=\"color:Blue\">var</span> selection = zip.SelectEntries (<span style=\"color:#A31515\">&quot;*.*&quot;</span>, <span style=\"color:#A31515\">&quot;&quot;</span>);\r\n\r\n    <span style=\"color:Blue\">foreach</span> (<span style=\"color:Blue\">var</span> e <span style=\"color:Blue\">in</span> selection)\r\n    {\r\n        Console.WriteLine(e.FileName);\r\n        e.Extract(_extractDir, overwrite);\r\n    }\r\n}\r\n</pre>\r\n</div>\r\n<p>If you need an example in VB, let me know.</p>",
    "PostedDate": "2009-08-10T15:38:49.163-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "221914",
    "ThreadId": "65031",
    "Html": "<p>Hi, what i meant by process the files in the root was select only the files that are in the root folder so I can process them in my application, not select any files that are within any directories in the zipfile. That example code you provided works great, I used the second example and it now ignores the __MACOSX that zip files created on a mac seem to insert for some reason!</p>\r\n<p>Thanks for your help</p>",
    "PostedDate": "2009-08-11T01:16:04.837-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]