Functions and Directives

Function FAttr() Foundation

Retrieves or modifies file attributes.

FAttr( <cFileName>, [<cAttribute>] ) --> cFileAttributes
<cFilename> is a character string containing the name of a file including the drive and path if necessary.
<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.

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
  1. applies to Windows platforms only


The function can be used to retrieve the current attributes of a file or to modify these.

Setting file attributes
// The example demonstrates how to set and remove 
// file attributes 

#include "" 

   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" 

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.