Hi,
I have been googling for a batch file that can be used to count the number of folders in a given location, for example “h:\”. So far all i can seem to find it ways of counting files but not folders.
Is it possible to count folders? i only need to count root folders and not sub folder, can someone please help?
Thanks,
Private Sub Command1_Click()
ListDirectories
End Sub
Sub ListDirectories()
Dim folName As String
Dim folPath As String
Dim folCounter As Integer
folCouunter = 0
folPath = “J:”
folName = Dir(folPath, vbDirectory)
Do Until Len(folName) = 0
If GetAttr(folPath & folName) = vbDirectory Then
folCounter = folCounter + 1
End If
folName = Dir
Loop
MsgBox folCounter
End Sub