Loop through and print directory size

Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFolder = objFSO.GetFolder("C:\")

Set colSubfolders = objFolder.Subfolders

For Each objSubfolder in colSubfolders
  on error resume next
  Wscript.Echo objSubfolder.Name, objSubfolder.Size
Next

Leave a Reply

Your email address will not be published. Required fields are marked *

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