Notice Of Closure

Please note that this website is due to close down on 15th June 2020.

In the interim I will try to move as much content as possible over to my GitHub account. Thanks to everyone who has supported the site over the years.

» Help

How to get the size of a text file without opening it

   

This function returns the size, in bytes, of the passed file:

function TextfileSize(const name: string): LongInt; 
var
  SRec: TSearchRec;
begin
  if FindFirst(name, faAnyfile, SRec) = 0 then
  begin
    Result := SRec.Size;
    Sysutils.FindClose(SRec);
  end
  else
    Result := 0;
end;
Original resource: The Delphi Pool
Author: Peter Below
Added: 2010-06-02
Last updated: 2010-06-02

« Return to contents »