CountDirectories()

Syntax

CountDirectories(Directory$)

Remarks

Returns the number of subfolders contained within Directory$. If Directory$ is omitted, the current folder is assumed. If Directory$ does not exist, CountDirectories() returns –1.

Example

This example determines whether there are any subfolders in the Word program folder. On the Macintosh, substitute a folder name such as HD:WORD 6.


dirNum = CountDirectories("C:\WINWORD")
If dirNum = 0 Then
    MsgBox "No subfolders."
Else
    MsgBox "There are" + Str$(dirNum) + " subfolders."
End If

See Also

Files$(), GetDirectory$()