Obter tamanho de um arquivo no Delphi

Inclua na seção uses: SysUtils

{ A função abaixo retorna o tamanho do arquivo, ou -1
  se o arquivo não for encontrado }



function tbFileSize(const FileName: string): integer;
var
  SR: TSearchRec;
  I: integer;
begin
  I := FindFirst(FileName, faArchive, SR);
  try
    if I = 0 then
      Result := SR.Size
    else
      Result := -1;
  finally
    FindClose(SR);
  end;
end;