0

Hey all,

I need a bit of help, Im trying to write some simple code that will search through a directory say "C:\Windows\" for any .exe's heres my code for just searching a directory, However it does not search Subfolders

If Directory.Exists(File_Path) Then

            Dim new_files As String() = _
                Directory.GetFiles(File_Path, "*.exe")

           For Each file_name As String In new_files
              
                 Console.WriteLine(file_name)
               
    
  

            Next file_name

            Console.WriteLine("The number of files that are .exe             _                  {0}.", new_files.Length)
    Else
            Console.WriteLine("Directory " & File_Path & " Does not exist"

End If

Any ideas how i can mod this to look in sub folders too??

1
Contributor
1
Reply
4
Views
10 Years
Discussion Span
Last Post by mstester
0

Ok my bad I got this myself just after posting (Sorry). Just for those how may want to know the new code looks like this

If Directory.Exists(File_Path) Then

            Dim new_files As String() = _
                Directory.GetFiles(File_Path, "*.exe", _                       
                 SearchOption.AllDirectories)

Note the SearchOPtion.AllDirectories :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.