Function to determine Directory Size

B

Bob Chmara

I'd like to be able to determine the size of a directory or group of files.
Does anyone know of an add-in that has a function whereby I can specify a
path and get the size of directory of groups of files as the return value?
Ex:
=dirsize("C:\Documents and Settings\Bob\My Documents\School")
=dirsize("C:\Documents and Settings\Bob\My Documents\School\*.doc")

It would also be helpful if there were an option to include subdirectories.
 
B

Bob Chmara

Argh....

Make that "get the size of a directory or group of files"

Bob

"Bob Chmara" fatfingered...
| specify a path and get the size of directory of groups of files as the
return value?
 
D

Dana DeLouis

I think this will do a folder, but I'm not sure of a way to do wildcard on
individual files. Hopefully someone can add to this.

Function DirSize(s As String) As Double
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
DirSize = fso.GetFolder(s).Size
End Function

?DirSize("C:\Documents and Settings\Bob\My Documents\School")

HTH
Dana DeLouis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top