DirSize

Finds the total size of a directory.

Syntax:

DirSize (dir-name, flags [, format])

Parameters:

(s) dir-name directory name

(i) flags 0 or 1. see below.

(i) format (optional) controls the format in which the size is returned, if it is too large to be returned as an integer.
0 - (default) The return value will be a floating point number if it is larger than 2 gigabytes.
1 - the size will be returned as a huge number. This is a long decimal number string, which may represent a number too large to be converted to a 32-bit integer. 2 gigabytes.
2 - size is represented by a 64-bit integer

Returns:

(i/f) size in bytes. The return value will be a floating point number if it is larger than 2 gigabytes.

 

This function returns the total size of a directory, including all files in the directory, and all files in all subdirectories under the directory.

Flags

Meaning

0

Actual size of the files.

 

1

Instead of returning the actual size of the files, return the amount of disk space they occupy. This is based upon the disk's cluster size. This flag is valid only if the specified directory is on a local drive or a network drive mapped to a drive letter; it does not support UNC's.

 

 

Format

This is an optional parameter that controls the format in which the size is returned. If the result is too large to be returned as an integer (larger than 2 gigabytes).

Format

Meaning

0

(Default) Floating Point
 

1

Huge number. This is a long decimal number string, which may represent a number too large to be converted to a 32-bit  integer.'Huge number' is a special data type. It is a long decimal number string, which may represent a number too large to be converted to an integer. This value can be modified with standard arithmetic operations.

2

64-bit Integer. This number representation is fully compatible with arithmetic and relational operators but some functions may error when the number is used as a function parameter if the number is greater than  the maximum 32-bit integer .
 

 

Notes:

 

A large total size can cause "representational" errors because DirSize uses a floating point accumulator internally.

This function supports extended-length path names.

 

Example:


a=DirSize("C:\Windows",0)
Message("DirSize : Actual size",a)
b=DirSize("C:\Windows",1)
Message("DirSize :The amount of disk space occupied",b)
c=DirSize("C:\Windows",1,0)
Message("DirSize :Actual size: in floating point if over 2 GB",b)

See Also:

DirExist, DirItemize, DirInfoToArray