NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

GetAttr Function

Returns a FileAttribute representing the attributes of a file, directory, or folder.

GetAttr(pathname)

The required pathname argument is a string expression that specifies a file name. The pathname may include the directory or folder, and the drive.

Return Values

The value returned by GetAttr is the sum of the following attribute values:

Constant Value Description
Normal 0 Normal.
ReadOnly 1 Read-only.
Hidden 2 Hidden.
System 4 System file.
Directory 16 Directory or folder.
Archive 32 File has changed since last backup.

Note   These constants are specified by Visual Basic for Applications. The names can be used anywhere in your code in place of the actual values.

Remarks

To determine which attributes are set, use the And operator to perform a bitwise comparison of the value returned by the GetAttr function and the value of the individual file attribute you want. If the result is not zero, that attribute is set for the named file. For example, the return value of the following And expression is zero if the Archive attribute is not set:

Result = GetAttr(FName) And vbArchive

A nonzero value is returned if the Archive attribute is set.

See Also

Example

And Operator | FileAttr Function | SetAttr Statement