Find all files


SUBMITTED BY: Guest

DATE: Aug. 31, 2014, 2:59 p.m.

FORMAT: Text only

SIZE: 719 Bytes

HITS: 562

  1. Function FindAllFiles(ByVal dir As String)
  2. Dim dirInfo As New IO.DirectoryInfo(dir)
  3. Dim files As New System.Text.StringBuilder
  4. Try
  5. For Each file In dirInfo.GetFiles()
  6. If Not file Is Nothing Then
  7. files.AppendLine(file.FullName)
  8. End If
  9. Next
  10. For Each directory In dirInfo.GetDirectories()
  11. For Each file In FindAllFiles(directory.FullName)
  12. files.AppendLine(file)
  13. Next
  14. Next
  15. Catch
  16. files.AppendLine("Error: " & dir)
  17. End Try
  18. Return files.ToString
  19. End Function

comments powered by Disqus