Function FAttr() Foundation
Retrieves or modifies file attributes.
Syntax
FAttr( <cFileName>, [<cAttribute>] ) --> cFileAttributes
Parameters
<cFileName>
<cFilename> is a character string containing the name of a file including the drive and path if necessary.
<cAttribute>
<cAttribute> is a character string describing the attributes to be set for a file. To specify the file attributes, the passed string must contain one or more of the characters listed for the return value. The character "D", however, cannot be used for <cAttribute>.
To remove a file attribute, the corresponding character must be prefixed with a minus sign.
Return
The function returns a string containing the attributes set for a file. Each character in the returned string represents one file attribute according to the following table.
File attributes
Attribute | Meaning | Description |
---|---|---|
D | Directory | File is a directory |
H | Hidden | Hidden file |
S | System | File is part of the operating system |
R | Read-only | File cannot be overwritten |
A | Archive | File will be included in backups |
N | Normal *) | File has no other attibutes |
C | Compressed *) | File is stored compressed |
|
Description
The function can be used to retrieve the current attributes of a file or to modify these.
Examples
// The example demonstrates how to set and remove
// file attributes
#include "Directry.ch"
PROCDURE Main
LOCAL aDir := Directory( "*.*" )
// Setting file attributes
AEval( aDir, {|a| FAttr( a[F_NAME], "R" ) } )
WAIT "Read-only attribute set"
AEval( aDir, {|a| FAttr( a[F_NAME], "+H" ) } )
WAIT "Hidden attribute set"
// Removing file attributes
AEval( aDir, {|a| FAttr( a[F_NAME], "-R-H" ) } )
WAIT "Attributes removed"
RETURN
Feedback
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.