Shell.GetDiskFreeSpace

Top  Previous  Next

Returns the available space for the given disk.

 

Syntax

function Shell.GetDiskFreeSpace(DirName: string): largeinteger

 

Alternative Names

ibec_GetDiskFreeSpace

 

Description

Returns the number of bytes available on the specified disk or directory.

 

DirName is a local disk or directory, this can be a UNC name. If the value is a UNC name, it must include a trailing backslash, eg "\\MyServer\MyShare\".

 

The Return Value is the number of free bytes for the given disk, or NULL in case of an error, use GetLastError or GetLastErrorMessage to return error information.

 

See Also

Shell.GetLastError
Shell.GetLastErrorMessage
GetDiskFreeSpaceExW on Microsoft.com

 

Example

execute UDSBlock returns (nr_of_free_bytes int64)

as

begin

  /* returns number of free bytes */
  nr_of_free_bytes = Shell.GetDiskFreeSpace('c:\');

  suspend;

 

  /* shows error message if 'a:' does not exist */

  nr_of_free_bytes = Shell.GetDiskFreeSpace('a:\');

  if (nr_of_free_bytes is null)

  then GUI.ShowMessage(Shell.GetLastErrorMessage());

end