Returns the size of a directory in bytes.
Caution: The execution of this function may take quite a long time depending on the size of the directory to analyze.
Syntax
<Result> = fDirSize(<Directory path> [, <Options>])
<Result>: Integer
- Size of the directory in bytes,
- -1 if an error or an interruption occurred. To get more details on the error, use ErrorInfo with the errMessage constant.
Remark: the hidden files are taken into account when calculating the size of the directory.
<Directory path>: Character string
Name and full (or relative) path of the directory to use (up to 260 characters). A UNC path can be used. Wildcard characters (*,?) are not allowed.
<Options>: Integer constant or combination of constants (optional)
Type of iteration performed for the directory files: | |
fdIgnoreError | If a directory cannot be browsed, it is ignored. If this constant is not specified, fDirSize returns an error. |
fdInterruptible | The iteration can be interrupted by pressing ESC. The function will return the name of directories listed until the interruption.
|
frNotRecursive | The iteration is non-recursive. Subdirectories are ignored. |
frRecursive (Default value) | The iteration is recursive. Subdirectories are automatically taken into account. |
Remarks
fDirSize throws an error in the following cases:
- the specified directory does not exist,
- the name of the directory is invalid,
- the operation was interrupted by the user.