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 or 3, may be a timestamp.

(See: Bitwise Parameters & Operations)

Mode

Controls the action of this function.

0 or Invalid (Default) - The file attributes will be set according to the Attributes parameter.

1 - Date modified using local timestamp.

2 - Reserved. Do Not Use.

3 - Date modified using UTC timestamp.

Comments:

Four file attributes may be set by this statement. All attributes will be changed at once.

Mode 1 (local timestamp) expects a timestamp local to the server receiving the command.

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.