Recursive Search for 'tif' images

lothos12345

Well-known member
Joined
May 2, 2002
Messages
294
Location
Texas
I have a vb.net application with an openfiledialog control on the form with a filter for .mdbs. The user selects the database and the filename property of the dialog box puts the path in a textbox on the form. What I also need the program to do is perform a recursive search for tifs starting in the directory where the database is located in and search all the directories that might be below the directory of the database. Any programming examples of how to accomplish this task is greatly appreciated.
 
lothos12345 said:
I have a vb.net application with an openfiledialog control on the form with a filter for .mdbs. The user selects the database and the filename property of the dialog box puts the path in a textbox on the form. What I also need the program to do is perform a recursive search for tifs starting in the directory where the database is located in and search all the directories that might be below the directory of the database. Any programming examples of how to accomplish this task is greatly appreciated.

Code:
Imports System.IO

Public Class FindFiles

    Public Shared Function FindFiles(ByVal basePath As String, ByVal searchPattern As String) As ArrayList
        Dim result As New ArrayList

        For Each dir As String In Directory.GetDirectories(basePath)
            result.AddRange(FindFiles(dir, searchPattern))
        Next

        For Each file As String In Directory.GetFiles(basePath, searchPattern)
            result.Add(file)
        Next

        Return result

    End Function


End Class

Called like so:

Code:
Dim result As ArrayList = FindFiles.FindFiles("some directory", "*.tif")
 
Back
Top