title: Check files in zip using DotNetZip
body: <p>So I have two functions that need help. </p>
  
  <pre><code>Public Function checkZipForFiles(ByVal zipFilepath As String)
      Try
          Dim doc As New System.Xml.XmlDocument
          If My.Computer.FileSystem.FileExists("Backup.xml") Then
              doc.Load("Backup.xml")
  
              Dim JobNodes As XmlNodeList = doc.GetElementsByTagName("Job")
              For Each JobNode In JobNodes
                  Dim Source = JobNode.SelectNodes("Source")
  
                  For Each item As System.Xml.XmlNode In Source
                      For Each File In checkFilesInFolder(item.InnerText)
                          Using zip = ZipFile.Read(zipFilepath)
                              Dim fileName As String
                              fileName = checkFilesInFolder(item.InnerText)
                              Dim e As ZipEntry = zip(fileName)
  
                              If e Is Nothing Then
                                  Console.WriteLine("File: " &amp; fileName &amp; " does not exist in zip.")
                              End If
                          End Using
                      Next
  
                  Next
              Next
          End If
      Catch ex As Exception
          Console.Error.WriteLine(ex.Message)
          myLogger.Log(ex.Message)
      End Try
  
  End Function
  </code></pre>
  
  <p>This one reads in an xml file. The xml file stores the information for the zipping process such as "Destination", "File Source", and "Job name". I want this function to check the the zip to see if all of the files are in the zip. As you can see this function needs the aid of "checkFilesiInFolder" function to get the filenames to search for in the zip. </p>
  
  <p>PROBLEM - I only get returned the last file that is scanned in the "checkFilesInFolder" function.</p>
  
  <pre><code>Public Function checkFilesInFolder(ByVal folderPath As String)
      Try
          ' make a reference to a directory
          Dim di As New IO.DirectoryInfo(folderPath)
          Dim diar1 As IO.FileInfo() = di.GetFiles()
          Dim file As IO.FileInfo
  
          Console.WriteLine("The following files are located in " &amp; folderPath)
  
          'list the names of all files in the specified directory
          For Each file In diar1
              Console.WriteLine(file.FullName)
              'myLogger.Log(file.ToString)
  
          Next
          Return file.ToString
      Catch ex As Exception
          Console.Error.WriteLine(ex.Message)
          myLogger.Log(ex.Message)
      End Try
  End Function
  </code></pre>