SETATTR statement

Purpose

Set the file system attribute(s) of a disk file or directory.

Syntax

SETATTR filespec$, attribute

Remarks

filespec$ specifies a filename (optionally including a drive letter and directory path).  attribute is a standard operating system attribute code:

Attribute

Description

Equate*

0

Normal

%NORMAL

1

Read-only

%READONLY

2

Hidden

%HIDDEN

4

System

%SYSTEM

32

Archived

%ARCHIVE

* These equates can be found in the WIN32API.INC file

The attribute code of a given file or directory may be constructed from a combination of individual attribute values.  For example, if you use an attribute of 0, filespec$ will be a regular file: not read-only, not hidden, not system, and not archived.

See also

DIR$, FILEATTR, GETATTR

Example

Files$ = "MYTEST.DAT"

SETATTR Files$, %HIDDEN + %SYSTEM

IF ISFALSE ERR THEN a$ = Files$ + " has been hidden!"