Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Get Folder Size 2

Status
Not open for further replies.

gwinn7

Programmer
Feb 10, 2001
1,004
US
Does anyone have any code that fetches the size of a particular folder on a local or network drive? For example

C:\My Documents ==> 4522623 Bytes
N:\Shared ==> 10002112 Bytes

Gary
gwinn7
 
Add a reference to the Microsoft Scripting Runtime to your project. Then drop the following into a module:

Public Function GetFolderSize(ByVal strFolder As String) As Long
Dim fso As FileSystemObject

Set fso = New FileSystemObject

GetFolderSize = fso.GetFolder(strFolder).Size
Set fso = Nothing
End Function
 
This is great and very usable. Thank you. Are there any API techniques for this as well?

Thanks again!

Gary
gwinn7
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top