CT_FILESIZE

 FILESIZE()
 Determines the size of a file
------------------------------------------------------------------------------
 Syntax

     FILESIZE([<cFileMap>, [<FileAttr>]]) --> nFileSize

 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

     FILESIZE() returns the 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:

     Table 7-16:  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

See Also: FILESEEK() FILEATTR() FILEDATE() FILETIME()

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.