Code: Select all
FolderSize(folder) { ;gwarble 2020 - any faster method to get folder size?
Loop, Parse, % RunCMD("robocopy /l /nfl /ndl " folder " . /r:0 /w:0 /e /bytes"), `n, `r
If InStr(A_LoopField,"Bytes :") ;thanks SKAN for RunCMD()
For each, z in StrSplit(RegExReplace(A_LoopField, "\s+", " "), " ")
If (A_Index = 4) ;probably much better ways to parse result
Return z
}
thanks to SKAN, FormatBytes() is useful in this case: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=3567