[
  {
    "Id": "432619",
    "ThreadId": "209746",
    "Html": "<p>I'm using VB.net 2008 with DotNetZip-v1.9.</p>\r\n<p>I'm extracting files that only contain one entry. When they are extracted a sub directory in created and they are placed in it.</p>\r\n<p>I do not want a sub directory created but for the file to be extracted directly to the root folder containing the zip.</p>\r\n<p>Here is what I tried and errors that I received:</p>\r\n<p>1)</p>\r\n<p>TheFile is a System.IO.FileInfo</p>\r\n<p><span style=\"color:#0000ff\">Using</span> ThisZIP <span style=\"color:#0000ff\">As</span> ZipFile = ZipFile.Read(TheFile.FullName)</p>\r\n<p style=\"padding-left:30px\"><span style=\"color:#0000ff\">For Each</span> ThisEntry <span style=\"color:#0000ff\">As </span>ZipEntry <span style=\"color:#0000ff\">In </span>ThisZIP.Entries</p>\r\n<p style=\"padding-left:60px\">ThisEntry.FileName = System.IO.Path.GetFileName(ThisEntry.FileName)</p>\r\n<p style=\"padding-left:60px\">ThisEntry.Extract(&quot;E:\\DataTemp\\&quot;, ExtractExistingFileAction.DoNotOverwrite)<span style=\"color:#0000ff\">&nbsp;</span></p>\r\n<p style=\"padding-left:30px\"><span style=\"color:#0000ff\">Next</span></p>\r\n<p><span style=\"color:#0000ff\">&nbsp;</span><span style=\"color:#0000ff\">End Using</span></p>\r\n<p><span style=\"color:#0000ff\"><span style=\"color:#000000\">The file is extracted properly in the correct directory but I then get an exception thrown:</span></span></p>\r\n<p>&quot;Collection was modified; enumeration operation may not execute.&quot;</p>\r\n<p>2)Since there is only one entry in my zips I would prefer to just use ExtractAll, but I can not get it to extract to the root folder of the zip.</p>\r\n<p><span style=\"color:#0000ff\">Dim </span>ExtractedFullName <span style=\"color:#0000ff\">As </span>String = TheFile.FullName.Remove(TheFile.FullName.Length - 4) &amp; &quot;.xml&quot;</p>\r\n<p><span style=\"color:#0000ff\">Using </span>ThisZIP <span style=\"color:#0000ff\">As </span>New ZipFile(TheFile.FullName)</p>\r\n<p style=\"padding-left:30px\">ThisZIP.ExtractAll(ExtractedFullName)</p>\r\n<p><span style=\"color:#0000ff\">End Using</span></p>\r\n<p><span style=\"color:#0000ff\"><span style=\"color:#000000\">3) This was an example I found on a discussion but the ExtractAll() gives a error if I don't add a parameter to it.</span></span><br><span style=\"color:#0000ff\">Using </span>zip <span style=\"color:#0000ff\">As </span>ZipFile.Read(FilePath)</p>\r\n<p style=\"padding-left:30px\">zip.StatusMessageTextWriter= System.Console.Out</p>\r\n<p style=\"padding-left:30px\">'Status Messages will be sent to the console during extraction</p>\r\n<p style=\"padding-left:30px\">zip.ExtractAll()</p>\r\n<p><span style=\"color:#0000ff\">End Using</span><br><br>4)This is what I'm using now. It works but I don't like it.</p>\r\n<p><span style=\"color:#0000ff\">Using </span>ThisZIP <span style=\"color:#0000ff\">As </span>ZipFile = ZipFile.Read(TheFile.FullName)</p>\r\n<p style=\"padding-left:30px\">ThisZIP.Entries(0).FileName = System.IO.Path.GetFileName(ThisZIP.Entries(0).FileName)</p>\r\n<p style=\"padding-left:30px\">ThisZIP.Entries(0).Extract(&quot;E:\\DataTemp\\&quot;, ExtractExistingFileAction.DoNotOverwrite)</p>\r\n<p><span style=\"color:#0000ff\">End Using</span></p>\r\n<p><span style=\"color:#0000ff\"><span style=\"color:#000000\">If you have any suggestions, I appreciate it. I have spent some time searching thru the other discussions but have not found the answer I thought I needed.</span></span></p>\r\n<p><span style=\"color:#0000ff\"><span style=\"color:#000000\">Thanks,<br></span></span></p>\r\n<p><span style=\"color:#0000ff\"><br></span></p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-04-19T02:07:08.653-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "433737",
    "ThreadId": "209746",
    "Html": "This discussion has been copied to a work item. Click <a href=\"http://dotnetzip.codeplex.com/WorkItem/View.aspx?WorkItemId=10683\">here</a> to go to the work item and continue the discussion.",
    "PostedDate": "2010-04-21T09:16:43.09-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]