FileAttr
Determines a file’s attributes
Syntax
FileAttr([<cFile>]) --> <nFileAttr>
Argument
<cFile> : File name, including the path and drive designation.
Returns
<nFileAttr> : a numeric value for file attributes
Description
FileAttr() is implemented alone or in conjunction with FileSeek(). If the function is called with the <cFile> parameter, it returns the attribute of the first entry found. If no acceptable entry is available, a value of 0 is returned.
When called without a parameter, FileAttr() returns the attribute for the most-recent file located with FileSeek(). When used with FileSeek(), you can determine the attribute for file groups (wildcards).
When you call FileAttr() with the <cFile> parameter, the function internally passes 63 (all attributes) as a mask. When used in conjunction with FileSeek(), you should also designate all 63 as an attribute mask, if all files are to be acknowledged.
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) 8 FA_VOLUME VOLUME (Name of a floppy/hard disk) 16 FA_DIRECTORY DIR (Directory) 32 FA_ARCHIVE ARCHIVE (Changes since last backup) ---------------------------------------------------------------
If multiple attributes are implemented for a file, the value of each corresponding attribute is added.
Examples
. Show the attribute of a specific file: ? FileAttr("C:\TEXT\TEXT.TXT") // 32 ARCHIVE . The attribute for an ARCHIVE/HIDDEN file: ? FileAttr("C\HIDE.TXT") // 34 HIDDEN + ARCHIVE . Used in conjunction with FileSeek(): cFile := FileSeek("C:\TEXT\TEXT.TXT") DO WHILE .NOT. EMPTY (cFile) ? cFile, FileAttr() // Name & file attribute cFile := FileSeek() // Search for next entry ENDDO
Seealso