Returns the size in bytes of a given directory.
DirGetSize( "path" [, flag] )
Parameters
dest dir | The directory path to get the size from, eg. "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) |
Return Value
Success: | Returns >= 0 the sizes |
Failure: | Returns -1 and sets @error to 1 if the path doesn't exist. |
Remarks
If the script is paused then this function is paused too and will only continue when the script continues!
Related
None.
Example
$size = DirGetSize("C:")
Msgbox(0,"","Size(MegaBytes):" & Round($size / 1024 / 1024))
$size = DirGetSize("C:\Windows", 2)
Msgbox(0,"","Size(MegaBytes):" & Round($size / 1024 / 1024))
$timer = TimerInit()
$size = DirGetSize("\\10.0.0.1\h$",1)
$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