GETATTR(pathname)

Returns the attributes of a given file or directory (Integer).


pathnameThe full pathname of the file you want to examine (String).

REMARKS
* The "pathname" may include a directory and drive.
* The value returned corresponds to the vbFileAttribute enumeration.
* The value returned is a sum of the following values:
* 0 = vbNormal.
* 1 = vbReadOnly.
* 2 = vbHidden.
* 4 = vbSystem. Not available on Macintosh.
* 16 = vbDirectory.
* 32 = vbArchive. Not available on Macintosh.
* 64 = vbAlias. Only on Macintosh.
* The easiest way to find out which attributes are set is to use the AND operator to perform a bitwise comparison of the value and the value of the individual file attribute (result = GetAttr(sFileName) And vbArchive.
* You can use the DIR to check if a file or directory exists.
* You can use the SETATTR statement to define the attributes of a file or directory.
* The equivalent .NET function is Microsoft.VisualBasic.FileSystem.GetAttr
* For the Microsoft documentation refer to learn.microsoft.com

If (GetAttr("C:\temp\myfile.docx") = vbFileAttribute.vbArchive + vbFileAttribute.vbReadOnly) Then 
If (GetAttr("C:\temp\myfile.docx") = 32) Then

© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited Top