Hey there!
I need to be able to get the total number of files in a directory and its subdirectories.
Ive written this sub to get the number of files:

VB Code:
  1. Private Sub CountFiles(ByVal path As String)
  2.         Dim di As New DirectoryInfo(path)
  3.         For Each fi As FileInfo In di.GetFiles
  4.             files += 1
  5.         Next
  6.         For Each d As DirectoryInfo In di.GetDirectories
  7.             CountFiles(d.FullName)
  8.         Next
  9.     End Sub

but Im just wondering if theres a faster way?

Im making an application that will loop through a directory and its subdirs and process all its files. But I dont have a progressbar showing the progress yet, Im going to add one now but then I'd need to have the total number of files that are to be processed. Using this sub is sometimes slow, and, I wouldnt want to slow the whole thing down.

Thanks