Returns the size in bytes of a given directory.
DirGetSize ( "path" [, flag] )
| path | The directory path to get the size from, e.g. "C:\Windows". |
| flag | [optional] this flag determines the behaviour and result of the function, and can be a combination of the following: 0 = (default) 1 = Extended mode is On -> returns an array that contains extended information (see Remarks). 2 = Don't get the size of files in subdirectories (recursive mode is Off) |
| Success: | Returns >= 0 the sizes |
| Failure: | Returns -1 and sets @error to 1 if the path doesn't exist. |
Local $size = DirGetSize(@HomeDrive)
MsgBox(0, "", "Size(MegaBytes):" & Round($size / 1024 / 1024))
$size = DirGetSize(@WindowsDir, 2)
MsgBox(0, "", "Size(MegaBytes):" & Round($size / 1024 / 1024))
Local $timer = TimerInit()
$size = DirGetSize("\\10.0.0.1\h$", 1)
Local $diff = Round(TimerDiff($timer) / 1000) ; time in seconds
If IsArray($size) Then
MsgBox(0, "DirGetSize-Info", "Size(Bytes):" & $size[0] & @LF _
& "Files:" & $size[1] & @LF & "Dirs:" & $size[2] & @LF _
& "TimeDiff(Sec):" & $diff)
EndIf