Thursday, September 27, 2007

VBScript to get size of all subfolders in a directory

'Script Start


BaseDirectory = "D:\"

CheckFolder(BaseDirectory)

Function CheckFolder(Directory)
Set sss = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(Directory)
For each sf In f.subfolders
value = round(sf.Size/1048576,2)

wscript.echo sf.name & " " & Value & " Mb"

Next
End Function




'Script End



How to execute a VBScript

No comments: