Ecco il codice che ho usato:
codice:
Function analizza(ByVal x As System.IO.DirectoryInfo)
For Each file As IO.FileInfo In x.GetFiles
On Error Resume Next 'Cambierò con un Try..Catch per avere una performance migliore
a = a + 1 'Ovviamente ho già dichiarato "a" come Integer
Next
For Each dir As IO.DirectoryInfo In x.GetDirectories
analizza(dir)
Next
Return a
End Function
Che ne dici?? (@MItaly)
Invece quel che volevo aggiungere era un:
codice:
Function analizza(ByVal x As System.IO.DirectoryInfo)
For Each file As IO.FileInfo In x.GetFiles
On Error Resume Next 'Cambierò con un Try..Catch per avere una performance migliore
a = a + 1 'Ovviamente ho già dichiarato "a" come Integer
Next
For Each dir As IO.DirectoryInfo In x.GetDirectories
'AGGIUNGO:
If (ho accesso alla directory) Then
analizza(dir)
End If
Next
Return a
End Function
Questo alleggerirebbe per bene l'esecuzione!