[
  {
    "Id": "1094525",
    "ThreadId": "457443",
    "Html": "What I need to do is read into a zip file and copy out just a certain file that is specified by the user and put it in a destination folder. I've looked at a lot of different examples and have come up with different sets of code that don't work. If anyone could offer any help or advice, it would be greatly appreciated, thank you! Here are some examples:<br />\n<br />\n1)<br />\n<br />\nUsing zip As Ionic.Zip.ZipFile = ZipFile.Read(fileName.FullName)<br />\n<pre><code>                Dim entries As Ionic.Zip.ZipFile = zip.SelectEntries(stidToFind &amp; &quot;.crt&quot;)\n\n\n                zip.ExtractSelectedEntries(stidToFind &amp; &quot;.crt&quot;, String.Empty, destinationDirectory, ExtractExistingFileAction.OverwriteSilently)\n\n                End Using</code></pre>\n\n<hr />\n2)<br />\n<br />\nTry<br />\n<pre><code>                    Using zip As ZipFile = ZipFile.Read(fileName.FullName)\n                        Dim zipToExtract As ZipEntry\n                       For Each zipToExtract In zip\n                           zipToExtract.Extract(stidToFind &amp; &quot;*.crt&quot;)\n                       Next\n                    End Using\n                Catch ex1 As Exception\n                   Console.Error.WriteLine(&quot;exception: {0}&quot;, ex1.ToString)</code></pre>\n\n<h2>End Try</h2>\n3)<br />\n<br />\n Using zip As ZipFile = ZipFile.Read(fileName.FullName)<br />\n<pre><code>                    Dim Threshold As Integer = stidToFind\n                    ' We cannot remove the entry from the list, within the context of\n                    ' an enumeration of said list.\n                    ' So we add the doomed entry to a list to be removed later.\n                    ' pass 1: mark the entries for removal\n                    Dim MarkedEntries As New System.Collections.Generic.List(Of ZipEntry)\n                    Dim entry As ZipEntry\n                    For Each entry In zip\n                        If (entry.Equals(Threshold)) Then\n                            MarkedEntries.Add(entry)\n                        End If\n                    Next\n                    ' pass 2: actually remove the entry.\n                    Dim selectedZip As ZipEntry\n                    For Each selectedZip In MarkedEntries\n                        zip.RemoveEntry(selectedZip)\n                        zip.ExtractSelectedEntries(selectedZip, String.Empty, destinationDirectory)\n                    Next\n\n                End Using</code></pre>\n\n<hr />\n4)<br />\n<pre><code>                Dim zip As Ionic.Zip.ZipFile = ZipFile.Read(fileName.FullName)\n                For Each ZipEntry In zip\n                    If ZipEntry.Info.Contains(stidToFindInt &amp; &quot;.crt&quot;) Then\n\n                        MsgBox(&quot;File Found : &quot; &amp; ZipEntry.FileName)\n\n                        'Extract File\n                        ZipEntry.Extract(FileIO.FileSystem.CurrentDirectory, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently)\n                        (ZipEntry, destinationDirectory)\n                        MsgBox(&quot;File : &quot; &amp; ZipEntry.FileName &amp; &quot; Extracted&quot;)\n\n                    End If\n\n                Next</code></pre>\n\n",
    "PostedDate": "2013-09-19T09:02:14.793-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]