How to Calculate the Approximate Size of a .DBF File (88987)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft FoxPro for MS-DOS 2.0
  • Microsoft FoxPro for MS-DOS 2.5
  • Microsoft FoxPro for MS-DOS 2.5a
  • Microsoft FoxPro for Windows 2.5
  • Microsoft FoxPro for Windows 2.5a

This article was previously published under Q88987
The following formula calculates the size of a .DBF database file

(RECSIZE() * RECCOUNT())+HEADER()+1

where:
  • RECSIZE returns the number of bytes for each record.
  • RECCOUNT returns the number of records in the .DBF file.
  • HEADER returns the size of the DBF header. The header includes all the information about the .DBF file, including field names and sizes.
This information can be very useful when you are trying to write backup routines for an application. You can use this formula in conjunction with the DISKSPACE function to determine if the backup copy of the database will fit on a disk.

Modification Type:MajorLast Reviewed:12/1/2003
Keywords:KB88987