GetDiskSpaceEx
InstallShield 2020 » InstallScript Language Reference
This function is obsolete. Use the GetDiskInfo function instead.
The GetDiskSpaceEx function returns the amount of free space on the specified path. The value passed in nUnits determines whether the value returned by GetDiskSpaceEx is a measure of bytes, kilobytes, megabytes, or gigabytes.
Syntax
GetDiskSpaceEx ( szDrive, nUnits );
Parameters
Parameter |
Description |
||||||||||||
szPath |
Specifies the path for which the function returns the amount of space available. The value specified can be a UNC path. |
||||||||||||
nUnits |
Pass one of the following predefined constants to indicate the measurement unit:
|
Return Values
Return Value |
Description |
> 0 |
The number of free bytes, kilobytes, megabytes, or gigabytes in the specified directory, depending on the value of nUnits. |
< 0 |
Indicates that GetDiskSpaceEx was unable to obtain the amount of free space. |
Additional Information
The limit of GetDiskSpaceEx is 2 giga-units (2 31) of the measurement unit you pass in nUnits. When you specify BYTES, the limit is 2 GB; when you specify KBYTES, the limit is 2 TB; and so on. You should specify KBYTES for most setups.
GetDiskSpaceEx returns the available space rounded down to the nearest single unit specified in nUnits. For example, if you specify GBYTES, a path that has 2.5 GB available will return 2. For setups that require more precise space information, call the Windows API function GetDiskFreeSpaceEx directly.
See Also