Gives the size in records of an open file System unit
 function FileSize ( var FileHandle : File; ) : Integer;
The FileSize function gives the size in records of an open file.
Before this function can be used, the file must be assigned a handle by using AssignFile and opened using Append, Reset or ReWrite routines.
Because text files are normally variable in length, the number of records is not so useful. Use the low level routine GetFileSize to get the size in bytes, or FindFirst, FindNext routines, which return size and last modified date values of one or more files.
Related commands
DiskFree Gives the number of free bytes on a specified drive
DiskSize Gives the size in bytes of a specified drive
Example code : Get the size in records of a typed binary file
  myWord, myWord1, myWord2, myWord3 : Word;
  myFile : File of Word;

  // Try to open the Test.cus binary file in write only mode
  AssignFile(myFile, 'Test.cus');

  // Before writing to the file, show the file size
  ShowMessage('File size = '+IntToStr(FileSize(myFile)));

  // Write a few lines of Word data to the file
  myWord1 := 123;
  myWord2 := 456;
  myWord3 := 789;
  Write(myFile, myWord1, myWord2, myWord3);

  // Before closing the file, show the new file size
  ShowMessage('File size now = '+IntToStr(FileSize(myFile)));

  // Close the file
Show full unit code
   File size = 0
   File size now = 3