GetAttr Function

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

āļšāˇāļģāļš āļģāˇ“āļ­āˇ’āļē:


RTrim (Text As String)

āļ†āļ´āˇƒāˇ” āļŊāļļāˇāļ¯āˇ™āļą āļ…āļœāļē:

Integer

āļ´āļģāˇāļ¸āˇ’āļ­āˇ“āļąāˇŠ:

File: āļąāˇ’āˇāˇŠāˇ€āļ­ āļœāˇœāļąāˇ” āļ´āˇ’āļģāˇ’āˇ€āˇ’āļ­āļģāļēāļšāˇŠ āļ‡āļ­āˇ’ āļ•āļąāˇ‘āļ¸ āļ­āļąāˇŠāļ­āˇ” āļ´āˇŠâ€āļģāļšāˇāˇāļąāļēāļšāˇŠ. āļ”āļļāļ§ URL āļ…āļ‚āļšāļąāļē āļˇāˇāˇ€āˇ’āļ­āˇ āļšāˇ’āļģāˇ“āļ¸āļ¯ āļšāļŊ āˇ„āˇāļš.

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

Error codes:

5 Invalid procedure call

53 File not found

āļ…āļœāļē

Named constant

Value

Definition

ATTR_NORMAL

0

Normal files.

ATTR_READONLY

1

Read-only files.

ATTR_HIDDEN

2

Hidden file

ATTR_SYSTEM

4

System file

ATTR_VOLUME

8

Returns the name of the volume

ATTR_DIRECTORY

16

Returns the name of the directory only.

ATTR_ARCHIVE

32

File was changed since last backup (Archive bit).


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

āļ‹āļ¯āˇāˇ„āļģāļĢāļē:


Sub ExampleSetGetAttr
On Error Goto ErrorHandler REM āļ¯āˇāˇ‚ āļ…āļŊāˇŠāļŊāˇ”āˇ€ āˇƒāļŗāˇ„āˇ āļ‰āļŊāļšāˇŠāļšāļē āļ…āļģāˇŠāļŽ āļ¯āļšāˇŠāˇ€āļēāˇ’
 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

Please support us!