FileAttrGetEx

Returns file attributes (extended).

Syntax:

FileAttrGetEx (filename)

Parameters:

(s) filename file whose attributes you want to determine.

Returns:

(i) extended attribute settings.

 

The return value is a bitmask comprised of one or more of the following integer values, combined using the bitwise OR ('|') operator:

 

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.

Example:


READONLY = 1
HIDDEN = 2
SYSTEM = 4
DIRECTORY = 16
ARCHIVE = 32
NORMAL = 128
TEMPORARY = 256
COMPRESSED = 2048
OFFLINE = 4096
NOT_CONTENT_INDEXED = 8192
ENCRYPTED = 16384
file = StrCat(DirWindows(0),"win.ini")
attr = FileAttrGetEx(file)
If attr & READONLY
   Message(file, "READONLY")
EndIf
If attr & HIDDEN
   Message(file, "HIDDEN")
EndIf
If attr & SYSTEM
   Message(file, "SYSTEM")
EndIf
If attr & DIRECTORY
   Message(file, "DIRECTORY")
EndIf
If attr & ARCHIVE
   Message(file, "ARCHIVE")
EndIf
If attr & NORMAL
   Message(file, "NORMAL")
EndIf
If attr & TEMPORARY
   Message(file, "TEMPORARY")
EndIf
If attr & COMPRESSED
   Message(file, "COMPRESSED")
EndIf
If attr & OFFLINE
   Message(file, "OFFLINE")
EndIf
If attr & NOT_CONTENT_INDEXED
   Message(file, "NOT_CONTENT_INDEXED ")
EndIf
If attr & ENCRYPTED
   Message(file, "ENCRYPTED ")
EndIf
Exit
See Also:

FileAttrSetEx, FileAttrSet, FileTimeGet, FileInfoToArray