SETFILEATTR

Action

Sets the attributes of a file.

 

Syntax

SETFILEATTR ("file name", attributes)

 

Parameter

File name

Identifies the file of which you want to set the attributes.

Attributes

Attributes to set for the file. The attributes can be one or more of the following values:

1

Read only

The file or directory is read-only. Applications can read the file but cannot write to it or delete it. In the case of a directory, applications cannot delete it.

2

Hidden

The file or directory is hidden. It is not included in an ordinary directory listing.

4

System

The file or directory is part of, or is used exclusively by, the operating system.

32

Archive

The file or directory is an archive file or directory. Applications use this attribute to mark files for backup or removal.

128

Normal

The file or directory has no other attributes set. This attribute is valid only if used alone.

256

Temporary

The file is being used for temporary storage. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.

4096

Offline

The data of the file is not immediately available. Indicates that the file data has been physically moved to offline storage.

 

Returns

0

Attributes set

Error code

Function failed

 

 

Example

$Result = SetFileAttr(@LDRIVE + "\Kix32.exe", 32)