vmaxx Site Admin

Joined: 27 Dec 2003 Posts: 132
|
Posted: Mon Jan 18, 2010 8:53 pm Post subject: VB 2008 Check number of files in directory |
|
|
| Code: | Dim s As String = "C:\FolderName"
Dim d As New System.IO.DirectoryInfo(s)
Dim intFolders, intFiles As Integer
intFolders = d.GetDirectories.GetUpperBound(0) + 1
intFiles = d.GetFiles.GetUpperBound(0) + 1
MsgBox("This directory (" & s & ") has " & intFolders.ToString & _
" folders and " & intFiles.ToString & " files.")
Replace "C:\FolderName" with the complete path to whatever folder you want to check. |
|
|