title: Using Ionic Zip to extract a folder inside a zip, to a root of another directory (without the contained folder in the zip)
body: <p>Im trying to get Ionic zip to extract a folder inside a zip file into a specified root directory. My problem is that the zip files inside is "zipfile.zip\some_folder\". I want to extract all the files within "some_folder" to another directory root.</p>
  
  <p>Heres what i have done </p>
  
  <pre><code>using (ZipFile zip = ZipFile.Read("zipfile.zip"))
  {
  var selection = (from cf in zip.Entries
                   where (cf.FileName).StartsWith("some_folder/")
                   select cf);
  
  foreach (var cf in selection)
      {
      try
          {
              cf.Extract(destinationPath, ExtractExistingFileAction.OverwriteSilently);
              progress.Value = progress.Value + 1;
          }
          catch (Exception ex)
          {
              installProblems = true;
          }
  
      }
  }
  </code></pre>
  
  <p>The problem with the above code is that it extracts the folder it self too into "destinationPath\some_folder" .. I want the files from "zipfile.zip\some_folder\" to be extracted in "destinationPath\"</p>
  
  <p>Hope you can assist!</p>
  
  <p>EDIT :</p>
  
  <p>So i tried out some few things, and came up with something that works, but i dont like it though:</p>
  
  <pre><code>using (ZipFile zip = ZipFile.Read("zipfile.zip"))
  {
      var selection = (from cf in zip.Entries
                                   where (cf.FileName).StartsWith("some_folder/")
                                   select cf);
  
      selection.ToList().ForEach(entry =&gt;
      {
          try
          {
              entry.FileName = entry.FileName.Substring(12);
              entry.Extract(minecraftPathVar, ExtractExistingFileAction.OverwriteSilently);
          }
          catch
          {
              installProblems = true;
          }
  
      });
  }
  </code></pre>
  
  <p>The above works, but i dont believe its a good practice even though the name "some_folder" is not changed at any time, i just dont like this kind of approach..</p>