Arquivos - tamanho REAL ocupado em disco |
Top Previous Next |
|
function TempDiskBlock: integer; var TP: array [1..4] of char; SetoresPorCluster, BytesPorSetor, FreeClusters, TotalClusters: DWORD;
begin if FDiskBlock > -1 then Result := FDiskBlock else begin TP:=Copy(TempPath,1,4); TP[4]:=#0; if GetDiskFreeSpace(PChar(TP),SetoresPorCluster,BytesPorSetor,FreeClusters, TotalClusters) then begin FDiskBlock:=SetoresPorCluster*BytesPorSetor; Result:=FDiskBlock; end; end; end;
Depois posso saber o tamanho real do arquivo fazendo o seguinte
function RealFileSize(b: int64): int64; begin if (b mod TempDiskBlock) = 0 then Result := b else Result := (b mod TempDiskBlock + 1) * TempDiskBlock; end; |