Format(' %1.2n GB', [FCurrentDI.BytesPerSector * FCurrentDI.SectorsPerCluster * FCurrentDI.NumberOfFreeClusters / 1024 / 1024 / 1024]);
Ungetested! Aber so sollte es was werden..
Wenn Du mir verräts was "FCurrentDI" ist? Verzeichnis ? Datei? Platte?
Vielleich hilft das weiter:
Delphi-Quellcode:
function GetFormatedFileSize(FileName: String): String;
var
FS : TFilestream;
Size: Cardinal;
begin
Result := FormatFloat('0.00', 0)+' Byte';
try
FS := TFileStream.Create(FileName, fmOpenRead + fmShareDenyNone);
Size := FS.Size;
FS.Free;
iTotalSize := iTotalSize + Size;
Result := FormatFloat('0.00', Size)+' Byte';
if Size > 10024 then
Result := FormatFloat('0.00', Size/1024)+' KB';
if Size > 1000024 then
Result := FormatFloat('0.00', Size/1024/1024)+' MB';
if Size > 100000024 then
Result := FormatFloat('0.00', Size/1024/1024/1024)+' GB';
except
end;
end;