How to get total number of folder counts in a drive

Description :


This code shows how to get total number of folder counts in a drive

[CODE]
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
MsgBox(GetFileCount("c:\"))

End If
End Sub
Public Function GetFileCount(ByVal strPath As String) As Integer
Try
Return System.IO.Directory.GetFiles(strPath).Length()
Catch ex As Exception
Throw New Exception("Error From GetFileCount Function" & ex.Message, ex)
End Try
End Function
End Class
[/CODE]

No comments:

Post a Comment

Plz Share your comments...