LGdBF‖

FAzGr‖GetAttr Function

WnrAC‖Returns a bit pattern that identifies the file type or the name of a volume or a directory.

XQjit‖Syntax:


45fLv‖GetAttr (Text As String)

mBMu7‖Return value:

upvgK‖Integer

CMxCD‖Parameters:

6rJQp‖ Text: Any string expression that contains an unambiguous file specification. You can also use URL notation.

9AAaj‖This function determines the attributes for a specified file and returns the bit pattern that can help you to identify the following file attributes:

SEjHR‖Error codes:

5 Invalid procedure call

53 File not found

mWtvF‖Value

hFQCm‖Named constant

zzPWS‖Value

iKvsu‖Definition

ATTR_NORMAL

0

aW6nL‖ Normal files.

ATTR_READONLY

1

rEyZA‖ Read-only files.

ATTR_HIDDEN

2

y5rDp‖ Hidden file

ATTR_SYSTEM

4

mxBAa‖ System file

ATTR_VOLUME

8

PEqDp‖ Returns the name of the volume

ATTR_DIRECTORY

16

WNbBd‖ Returns the name of the directory only.

ATTR_ARCHIVE

32

F9thH‖ File was changed since last backup (Archive bit).


LecDz‖If you want to know if a bit of the attribute byte is set, use the following query method:

CV4g5‖Example:


Sub ExampleSetGetAttr
WNBqB‖On Error GoTo ErrorHandler ' Define target for error handler
 If Dir("C:\test",16)="" Then MkDir "C:\test"
 If Dir("C:\test\autoexec.sav")="" Then FileCopy "c:\autoexec.bat", "c:\test\autoexec.sav"
 SetAttr "c:\test\autoexec.sav" ,0
 FileCopy "c:\autoexec.bat", "c:\test\autoexec.sav"
 SetAttr "c:\test\autoexec.sav" ,1
 Print GetAttr( "c:\test\autoexec.sav" )
 End
ErrorHandler:
 Print Error
 End
End Sub