SETATTR(pathname, attributes)

Defines the attributes of a file or directory.


pathnameThe valid filename and path.
attributesA vbFileAttribute constant specifying the file attribute:
vbNormal (0)
vbReadOnly (1)
vbHidden (2)
vbSystem (4)
vbVolume (8)
vbDirectory (16)
vbArchive (32)
vbAlias (64)

REMARKS
* Sets attributes for the file or directory specified by the pathname.
* If you try to set the attributes of an open file, a run-time error will be generated.
* On a Macintosh the constants vbSystem and vbArchive are not available.
* You can use the DIR to check if a file or directory exists.
* You can use the GETATTR function to return the attributes of a file or directory.
* The equivalent .NET statement is Microsoft.VisualBasic.FileSystem.SetAttr
* For the Microsoft documentation refer to learn.microsoft.com

SetAttr("C:\Temp.txt", 2) 
SetAttr("C:\Temp.txt", vbFileAttribute.vbNormal)
SetAttr("C:\Temp.txt", vbFileAttribute.vbReadOnly)
SetAttr("C:\Temp.txt", vbHidden + vbReadOnly)

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