FileSize
Determines the size of a file
Syntax
FileSize([<cFileMap>, [<FileAttr>]]) --> <nFileSiz>
Arguments
<cFileMap> : Designates the file name, path, and drive designation.
<FileAttr> : Designates the file attribute that is explained in the table below. The default value is 0. () : If the function is called without parameters, it returns the file size from the current FileSeek() buffer.
Returns
<nFileSiz> : a numeric value designated file’s size, the size from the FileSeek() buffer (when called without a parameter), or -1.
Description
Implement FileSize() alone or in conjunction with FileSeek(). If the function is called with the <cFileMap> parameter, it returns the size of the first entry found. If no matching entry is available, then a value of -1 is returned
When called without parameters, FileSize() returns the size of the most recent file found with FileSeek(). Used in conjunction with FileSeek(), you can also determine the size of file groups (wildcards).
You can designate the attribute for the desired file in numeric form:
Coding the File Attribute ---------------------------------------------------------------- Value Symb. constants Assigned attribute ---------------------------------------------------------------- 0 FA_NORMAL 1 FA_READONLY READ ONLY (Read-only) 2 FA_HIDDEN HIDDEN (Hidden files) 4 FA_SYSTEM SYSTEM (System files) 32 FA_ARCHIVE ARCHIVE (Changes since last backup.) ----------------------------------------------------------------
Specify only the SYSTEM, HIDDEN, VOLUME, or DIR attributes for an entry to be found. If multiple attributes are implemented simul-taneously, the table values are added accordingly. Of course, not all combinations are useful.
Examples
. Show the size of a particular file: ? FileSize("C:\TEXT\TEXT.TXT") // File size or -1 . The size of an ARCHIVE/HIDDEN file: ? FileSize("C:\HIDE.TXT", 34") // File size or -1 . Used in conjunction with FileSeek(): cFile := FileSeek(C:\TEXT.TXT") DO WHILE .NOT. EMPTY(cFile) ? cFile, FileSize() // File name and size cFile := FileSeek() // Search for next entry ENDDO
Seealso