Syntax |
GetAttr(filename$) |
||
Description |
Returns an Integer containing the attributes of the specified file. |
||
Comments |
The attribute value returned is the sum of the attributes set for the file. The value of each attribute is as follows: |
||
|
Constant |
Value |
Includes |
|
EbNormal |
0 |
Read-only files, archive files, subdirectories, and files with no attributes. |
|
EbReadOnly |
1 |
Read-only files |
|
EbHidden |
2 |
Hidden files |
|
EbSystem |
4 |
System files |
|
EbVolume |
8 |
Volume label |
|
EbDirectory |
16 |
DOS subdirectories |
|
EbArchive |
32 |
Files that have changed since the last backup |
|
EbNone |
64 |
Files with no attributes |
|
To determine whether a particular attribute is set, you can And the values shown above with the value returned by GetAttr. If the result is True, the attribute is set, as shown below: Sub Main() |
||
Example |
This example tests to see whether the file test.dat exists. If it does not, then it creates the file. The file attributes are then retrieved with the GetAttr function, and the result is displayed. Const crlf = Chr$(13) + Chr$(10) |
||
|
Sub Main() Again: If y% = 0 Then msg1 = msg1 &
"This file has no special attributes." & crlf MsgBox msg1 |
||
See Also |
G |