' Get The Sizes of Folder and Subfolders recursively

folder="c:\temp"

Set fso = CreateObject("Scripting.Filesystemobject")

result=""
Browse fso.GetFolder(folder),""

arr = Split(result,vbCrLf)

For i=UBound(arr) to0 Step -1
  WScript.Echo arr(i)
Next

Function Browse(myfolder,indent)

  Dim size
  size=0
  ForEach fileIn myfolder.Files
    size=size+file.Size
  Next

  ForEach subfolderIn myfolder.SubFolders
    size=size + Browse(subfolder,indent & "  ")
  Next
  
  result = result & indent & myfolder.Name & " [" & size & "]" & vbCrLf
  
  Browse=size
EndFunction

search for scripts

VbsEdit contains all these sample scripts!


Download Now!



Download   Home   Scripts

Copyright © 2001-2024 adersοft