[
  {
    "Id": "502891",
    "ThreadId": "229775",
    "Html": "<p>Im trying to create a small method that extract a folder from my zip file.<br>I would think that this is the right method, although i can't get it to work.&nbsp;</p>\r\n<p>Maybe its just me who is stupid and&nbsp;can't see the forest for the trees :S</p>\r\n<p>\r\n<div style=\"color:black;background-color:white\">\r\n<pre>        <span style=\"color:blue\">private</span> <span style=\"color:blue\">void</span> MyExtract()\r\n        {\r\n            <span style=\"color:blue\">using</span> (ZipFile zip = ZipFile.Read(<span style=\"color:#a31515\">@&quot;C:\\zipname.zip&quot;</span>))\r\n            {\r\n                ZipEntry e = zip[<span style=\"color:#a31515\">&quot;foldername_in_zip&quot;</span>];\r\n                e.Extract(<span style=\"color:#a31515\">@&quot;C:\\Somewhere\\on\\my\\drive&quot;</span>);\r\n            }\r\n        }\r\n</pre>\r\n</div>\r\n</p>",
    "PostedDate": "2010-10-06T02:58:17.303-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "502969",
    "ThreadId": "229775",
    "Html": "Yes, I'm afraid <b>it IS you</b>.  ;) There is no support in the zipfile format for a concept of object like &quot;folder&quot;. You cannot operate on a &quot;folder&quot; that is contained in a zipfile in the same way you can operate on a folder in the Windows Explorer. <br><br>\r\n\r\nThere is an entry type for a <i>directory</i> in the zip format, but the directory is not a container object. It contains no other files or sub-directories. If you want to access a directory from within a ZipFile, you should specify the name with a trailing slash. If you extract a ZipEntry that is of type directory (in other words the IsDirectory property is true), then DotNetZip will simply create the appropriate directory in your filesystem.  It will not extra t any &quot;contained&quot; files, because as I said, there is no containing relationship in the zipfile. <br><br>\r\n\r\nI suppose I could add this capability to the library, but I haven't, not yet anyway. <br><br>\r\n\r\nI can think of 3 ways to extract all the files in a &quot;folder&quot; within a ZipFile: 1. you can use the ExtractSelectedFiles() method.  2. Use a LINQ query, and call Extract() on each of the selected entries.  3.  iterate through all the entries, and compare the FileName property to the folder name you desire. \r\n<br><br>\r\ngood luck.",
    "PostedDate": "2010-10-06T06:30:03.817-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "502970",
    "ThreadId": "229775",
    "Html": "This discussion has been copied to a work item. Click <a href=\"http://dotnetzip.codeplex.com/workitem/12080\">here</a> to go to the work item and continue the discussion.",
    "PostedDate": "2010-10-06T06:32:00.303-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "503442",
    "ThreadId": "229775",
    "Html": "<p>Hi Cheeso,</p>\r\n<p>I use the ExtractSelectedFiles() method, but the function doesn&acute;t work recursive for&nbsp; subdirectories, it is right???</p>\r\n<p>To solve this problem I write this solution, but is there another way?</p>\r\n<div style=\"color:black;background-color:white\">\r\n<pre>\tICollection&lt;Ionic.Zip.ZipEntry&gt; test = zip.SelectEntries(<span style=\"color:#a31515\">&quot;Applications\\\\*.*&quot;</span>);\r\n   \t<span style=\"color:blue\">foreach</span> (Ionic.Zip.ZipEntry file <span style=\"color:blue\">in</span> test)\r\n        {\r\n        \tfile.Extract(tbTarget.Text);\r\n        }</pre>\r\n<pre>With kind regards</pre>\r\n<pre>Origon\r\n</pre>\r\n</div>",
    "PostedDate": "2010-10-07T00:30:27.793-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "507456",
    "ThreadId": "229775",
    "Html": "<p>I don't know what you mean by &quot;is there another way?&quot;.&nbsp;&nbsp; What is the problem you are trying to solve?&nbsp; What's unsatisfactory about what you're doing now?</p>\r\n<p>The file selection capability does support a filespec format to denote recursive selection:&nbsp; You need to use a * as a directory, eg &quot;Applications\\\\*\\\\*.*&quot;&nbsp; Check the documentation on the name criterion, in the FileSelector class, for more information.&nbsp; The way you have done it, &quot;Applications\\\\*.*&quot;, is not recursion.&nbsp; This will select only files in the 1st level directory.&nbsp; Any files in subdirectories will&nbsp; not be selected (this is what I mean by &quot;it's not recursion&quot;).&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-10-14T14:50:30.377-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "508775",
    "ThreadId": "229775",
    "Html": "<p>Ok, i will try to explain the problem.</p>\r\n<p>The method ExtractSelectedFiles() offers 5 possibilities to extraxt files. In my usecase I want extraxt all files from a folder and his subfolders (like the problem from cezor). The problem in the ExtractSelectedFiles() method is the following.</p>\r\n<p>If I use the method only with the selectionCriteria it works fine, even recursive (means extract the folder, all subfolders and all files inside the folders)</p>\r\n<p>&nbsp;</p>\r\n<div style=\"color:black;background-color:white\">\r\n<pre>ZipFile zip = ZipFile.Read(<span style=\"color:#a31515\">&quot;data.zip&quot;</span>);\r\nzip.ExtractSelectedEntries(<span style=\"color:#a31515\">&quot;Applications\\\\*.*&quot;</span>);</pre>\r\n</div>\r\n<p>&nbsp;</p>\r\n<p>If I want set a extract directory I have to use the 3. method invocation.</p>\r\n<p>&nbsp;</p>\r\n<div style=\"color:black;background-color:white\">\r\n<pre>zip.ExtractSelectedEntries(<span style=\"color:#a31515\">&quot;Applications\\\\*.*&quot;</span>, <span style=\"color:#a31515\">&quot;Applications&quot;</span>, <span style=\"color:#a31515\">&quot;.\\Result&quot;</span>);\r\n</pre>\r\n</div>\r\n<p>&nbsp;</p>\r\n<p>In this case the method extract only the files inside the folder &quot;Applications&quot;. (not recursive).</p>\r\n<p>I hope you understand my problem. I can&acute;t extract an folder with all subfolders to a target directory. Therefore I use code like in my first post.&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&quot;is there another way&quot; means: does a method exist that only get a foldername (without other syntax like *.*) , targetfolder and bool (recursive or not)???</p>\r\n<p>Cheeso: &quot;What's unsatisfactory about what you're doing now?&quot; --&gt; 1. It&acute;s to long, 2. no switch for recursion, 3. more than the foldername is necessary (*.*).</p>\r\n<p>Cheeso: &quot;The way you have done it, &quot;Applications\\\\*.*&quot;, is not recursion.&quot; Why not??? I get all files from a folder and his subfolders.</p>",
    "PostedDate": "2010-10-18T05:38:28.613-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "511749",
    "ThreadId": "229775",
    "Html": "This discussion has been copied to a work item. Click <a href=\"http://dotnetzip.codeplex.com/workitem/12341\">here</a> to go to the work item and continue the discussion.",
    "PostedDate": "2010-10-24T09:02:08.05-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]