Get the size of a file

function GetFileSize(const FileName: string): Integer;
var
  sr: TSearchRec;
begin
  Result := 0;

  if FindFirst(FileName, faAnyFile, sr) = 0 then
  begin
    Result := sr.Size;
    FindClose(sr);
  end;
end;

 

Share this article!

Follow us!

Find more helpful articles: