根据文件路径获取剩余磁盘空间

function GetFreeSize(filePath:String):Int64;
var
  FreeBytesAvailableToCaller : TLargeInteger;
  FreeSize : TLargeInteger;
  TotalSize : TLargeInteger;
  Drive : string;
begin
  Drive := ExtractFileDrive(filePath);
  GetDiskFreeSpaceEx(PChar(Drive),
                      FreeBytesAvailableToCaller,
                      Totalsize,
                      @FreeSize );
  Result := FreeSize;
end;

转载于:https://www.cnblogs.com/liwb1987/p/4606671.html

你可能感兴趣的:(根据文件路径获取剩余磁盘空间)