GetAttr Function [Runtime] /text/sbasic/shared/03020409.xhp Sun Microsystems, Inc. converted from old format - fpe
GetAttr function GetAttr Function [Runtime] Returns a bit pattern that identifies the file type or the name of a volume or a directory.
Syntax: GetAttr (Text As String) Return value: Integer Parameters: Text: Any string expression that contains an unambiguous file specification. You can also use URL notation. This function determines the attributes for a specified file and returns the bit pattern that can help you to identify the following file attributes: Value 0 : Normal files. 1 : Read-only files. 8 : Returns the name of the volume 16 : Returns the name of the directory only. 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: Example: Sub ExampleSetGetAttr On Error Goto ErrorHandler REM 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