Examples Delphi

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;