Function to return a folders size (vbs)

Here is a little VBS function that will return the size of a folder in bytes

set oFS = WScript.CreateObject("Scripting.FileSystemObject")
'Example of Usage
wscript.echo GetFolderSize("c:\temp")
'The Function
Function GetFolderSize(folderpath)
   set oFolder = oFS.GetFolder(folderpath)
   GetFolderSize = oFolder.Size
End function


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.