Controlli -Elencare Tutte Le Sottodirectory Di Una Data Directory




Visual # Da richiamare come segue:
Call ListSubDirs("C:\")
La routine fa uso della funzione accessoria IsAttr presente su questa stessa
pagina.
N.B. La lista delle directory viene visualizzata nella finestra di Debug
Sub ListSubDirs(strPath As String)
Dim strFile As String
If Right(strPath, 1) <> "\" Then
strPath = strPath & "\"
End If
If IsAttr(strPath, vbDirectory) Then
strFile = Dir(strPath, vbDirectory)
Do Until strFile = ""
If IsAttr(strPath & strFile, vbDirectory) Then
If strFile <> "." And _
strFile <> ".." Then
Debug.Print strFile
End If
End If
strFile = Dir
Loop
End If
End Sub











( controllielencaretuttelesottodirectorydiunadatadirectory.html )- by Paolo Puglisi - Modifica del 17/12/2023