Xbasic

FILE.ATTRIBUTES_SET Function

Syntax

Result as C = FILE.Attributes_Set(C filename,C attributes)

Arguments

filenameCharacter

A fully qualified file name.

attributesCharacter

File attributes to set. To turn an attribute on, you specify a flag of +<attribute>, where <attribute> is "R", "H", or "A". To turn an attribute off, you specify a flag of -<attribute>.

Attributes Syntax
Description
"-<attribute>"

Remove an attribute. E.g. -A.

"+<attribute>"

Add an attribute. E.g. +R

"A"

Archive

"H"

Hidden

"R"

Read-only

Returns

ResultCharacter

Returns a list of file attribute flags for the specified file. Use the FILE.EXISTS Function to determine whether or not the file exists.

Description

Sets file attributes for a file (-/+ R-readonly H-hidden A-Archive N-Normal).

Discussion

The FILE.ATTRIBUTES_SET() method sets the attributes for Filename. You can turn on or off the read-only, hidden, and archive attributes.

This turns off the read-only flag of a file.

fn = "c:\data\customer.dbf"
file.attributes_set(fn, "-R")
'This turns off the read-only flag and sets the Archive flag
file.attributes_set(fn, "-R + A")

See Also