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??

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.