Josh Face
Josh Face

Reputation: 107

VB.NET - Counting how many folders in a specific directory

What would be a suitable way to count how many folders are in a specific directory (not counting sub-folders or files within those folders, just the count of the folders in the specified directory).

I have looked around the Internet but could not find a suitable example.

Thanks.

Upvotes: 0

Views: 1272

Answers (1)

Precious Uwhubetine
Precious Uwhubetine

Reputation: 3007

It's as simple as this

Dim folderCount As Integer = IO.Directory.GetDirectories("c:\your_direcrory").Count()

Upvotes: 3

Related Questions