If I want to check how many files there are in a folder (where there is likely to be 10,000+ files), is there a more efficient way than…
Public Function FileCount(FolderName as String) As Integer
Dim Files() As String
Files = IO.Directory.GetFiles(FolderName)
Return Files.Length
End Function
It seems to be unweildly to be forced to load such a potentially large array. Any better suggestions?
Has it caused a problem? It’s not like GetFiles() is returning the contents of each file, it is returning to you their paths, i.e., a string array.