FileAttrSetEx

Sets file attributes (extended).

Syntax:

FileAttrSetEx (file-list, attributes, mode)

Parameters:

(s) file-list a delimited list of files. May contain wildcards. (example: "*.jpg|*.bmp")

(i) attributes specifies the attributes to apply to the specified file(s). see below.

(i) mode specifies the method by which "attributes" are applied to the specified file(s), and can be one of the following: 0 "attributes" replaces the existing file attributes 1 "attributes" are added to the existing file attributes
-1 "attributes" are removed from the existing file attributes

Returns:

(i) @TRUE on success, or @FALSE if unable to change the attributes on any of the specified files.

 

Value

Name

Meaning

1

READONLY

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.

16 *

DIRECTORY

Identifies a directory.

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 avoid writing data back to mass storage if sufficient cache memory is available, because often the application deletes the temporary file shortly after the handle is closed. In that case, the system can entirely avoid writing the data. Otherwise, the data will be written after the handle is closed.

512 *

SPARSE_FILE

The file is a sparse file.

1024 *

REPARSE_POINT

The file or directory has an associated reparse point.

2048 *

COMPRESSED

The file or directory is compressed. For a file, this means that all of the data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories.

4096

OFFLINE

The data of the file is not immediately available. This attribute indicates that the file data has been physically moved to offline storage. This attribute is used by Remote Storage, the hierarchical storage management software. Applications should not arbitrarily change this attribute.

8192

NOT_CONTENT_INDEXED

The file will not be indexed by the content indexing service.

16384 *

ENCRYPTED

The file or directory is encrypted. For a file, this means that all data streams in the file are encrypted. For a directory, this means that encryption is the default for newly created files and subdirectories.

* The values with an asterisk next to them cannot be set using FileAttrSetEx.

This function supports extended-length path names.

 

Examples:

ADD = 1
TEMPORARY = 256
curdir = DirGet()
tempfile = FileCreateTemp(StrCat(curdir,"TMP"))
FileAttrSetEx(tempfile, TEMPORARY, ADD)
Message("FileAttrSet",StrCat("TEMPORARY file created:",@CRLF, tempfile))
Exit

 

See Also:

FileAttrGetEx, FileAttrGet, FileTimeTouch