SetFileAttribs

(Engine-Level Function)

Description: Sets the attributes of the specified file.
Returns: Nothing
Usage: Script Only.
Function Groups: File I/O
Related to: GetFileAttribs
Format: SetFileAttribs(FileName, Attributes, Mode)
Parameters:  
FileName
Required. Any text expression giving the name of the file. A known path alias for File-Related Functions may be provided in the form, :{KnownPathAlias}.
Attributes
Required. Any numeric expression which designates the attributes to be set. This parameter is formed by adding together numbers from the following table:

Value

Bit No

Attribute

0

-

Normal

1

0

Read only

2

1

Hidden

4

2

System

8

3

Archive

Optionally if mode is 1, may be a timestamp.

(See: Bitwise Parameters & Operations)

Mode
Controls the action of this function. If invalid or set to 0, the file attributes will be set as noted above. If set to 1, then this function will set the file’s date.
Comments: Four file attributes may be set by this statement. All attributes will be changed at once.

Example:

  If StrictlyNotEqual(NewFile, OldFile);
  [
    SetFileAttribs(Concat(MyPath, NewFile), 9);
    OldFile = NewFile;
  ]

The above statement will cause file NewFile to have its ReadOnly and Archive bit set every time its name changes.