# VBForums CodeBank > CodeBank - Other >  [DELPHI] - Get Free Disk Space

## Madboy

```
procedure TForm1.Button1Click(Sender: TObject);
var
  freeSpace, totalSpace: Double;
  s: Char;
begin
  // Drive letter
  s := 'D';

  freeSpace  := DiskFree(Ord(s) - 64);
  totalSpace := DiskSize(Ord(s) - 64);

  label1.Caption := Format('Free Space: %12.0n', [freeSpace]);
  Label2.Caption := Format('Total Space: %12.0n', [totalSpace]);
  Label3.Caption := IntToStr(Round((totalSpace - freeSpace) / totalSpace * 100)) +
    ' Percent used.';
end;
```

----------

