function GetSpaceOnDisk64(const Path: String; var Free, Total: Int64): Boolean;
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.
var
Path: String;
FreeBytes, TotalBytes: Int64;
begin
// Get and display free bytes on the Program Files drive
Path := ExpandConstant('{autopf}');
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;