Pascal Scripting: GetSpaceOnDisk64

Inno Setup

Pascal Scripting: GetSpaceOnDisk64

Prototype:

function GetSpaceOnDisk64(const Path: String; var Free, Total: Int64): Boolean;

Description:

Returns the number of free and total bytes on a drive. Path specifies a directory on the drive or UNC share to check; it can be either the root (e.g. C:\) or an existing subdirectory. Returns True if successful, False otherwise.

Remarks:

Requires Unicode Inno Setup.

Example:
var
  Path: String;
  FreeBytes, TotalBytes: Int64;
begin
  // Get and display free bytes on the Program Files drive
  Path := ExpandConstant('{pf}');
  if GetSpaceOnDisk64(Path, FreeBytes, TotalBytes) then
  begin
    MsgBox('There are ' + IntToStr(FreeBytes) + ' bytes free on ' +
      Path, mbInformation, MB_OK);
  end
  else begin
    // the function failed
  end;
end;
See also:

GetSpaceOnDisk