DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Bob Guest

    Recursive Directory Search ?


    HI, How can I build with vb.net
    a fast search file in all the directory and the sub directory.

    Thanks, for your help

    Exemple: (But is not recursive)

    Private Sub scan(ByVal MyPath As String)
    Dim storefile As Directory
    Dim directory As String
    Dim files As String()
    Dim File As String
    Dim MyFile, MyName, A
    On Error Goto exitscan
    ' Display the names in C:\ that represent directories.
    ' MyPath = "D:\" ' Set the path.
    MyName = Dir(MyPath, VbDirectory) ' Retrieve the first entry.
    Do While MyName <> "" ' Start the loop.
    ' Ignore the current directory and the encompassing directory.
    If MyName <> "." And MyName <> ".." Then
    ' Use bitwise comparison to make sure MyName is a directory.
    If (GetAttr(MyPath & MyName) And VbDirectory) = VbDirectory
    Then
    ' Display entry only if it's a directory.
    Me.ListBox1.Items.Add(MyName)
    ' Debug.Write(MyName)
    A = MyPath & MyName & "\"
    files = storefile.GetFiles(A, "*.exe")
    For Each File In files
    Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(File)
    'Print the file name and version number.
    Me.ListBox1.Items.Add("File: " & File & " | " & myFileVersionInfo.FileDescription
    & ControlChars.Cr & _
    "Version number: " & myFileVersionInfo.FileVersion)
    Next
    End If
    End If
    MyName = Dir() ' Get next entry.
    Loop
    exitscan:

    End Sub

    Bob

  2. #2
    Phil Weber Guest

    Re: Recursive Directory Search ?

    > How can I build with VB.NET a fast search file in all
    > the directory and the subdirectory?


    Bob: http://www.aspheute.com/english/20000804.asp
    ---
    Phil Weber



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links