Hola.
Otra opción es usar la función API
GetDiskFreeSpaceEx.
Código Delphi
[-]
...
procedure GetDiskInfoSpace( Disk: string; var TotalBytes, FreeBytes: Int64 );
const
GB = 1024*1024*1024;
begin
Disk := IncludeTrailingPathDelimiter(Disk);
if not GetDiskFreeSpaceEx(PChar(Disk), FreeBytes, TotalBytes, nil) then
raise Exception.Create( SysErrorMessage(GetLastError));
TotalBytes := TotalBytes div GB;
FreeBytes := FreeBytes div GB;
end;
Ejemplo de uso:
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
var
FreeBytes,
TotalBytes: Int64;
begin
GetDiskInfoSpace('C:\', TotalBytes, FreeBytes);
ShowMessageFmt('Capacidad: %d Gb. %sEspacio libre: %d Gb.', [ TotalBytes, #$A, FreeBytes ]);
end;
Saludos