Name
SetAttr Procedure — Microsoft.VisualBasic.FileSystem
Synopsis
SetAttr(pathname
,attributes
)
pathname
required; StringThe name of the file or directory whose attributes are to be set
attributes
required;FileAttribute
enumerationNumeric expression,
FileAttribute
enumerated constant, or global VB constant specifying the attributes
Description
Changes the attribute properties of a file.
You can use any sum of the following constants to set the attributes of a file:
Constant |
Value |
Description |
|
0 |
Normal |
|
1 |
Read-only |
|
2 |
Hidden |
|
4 |
System |
|
32 |
File has changed since last backup |
Each global constant has a corresponding constant in the
FileAttribute
enumeration. For example,
vbNormal
is identical to
FileAttribute.Normal
. The file-attribute constants
vbDirectory
, vbAlias
, and
vbVolume
cannot be used when assigning attributes.
File-attributes constants can be Or
ed to set more
than one attribute at the same time. For example:
SetAttr "SysFile.Dat", FileAttribute.System Or FileAttribute.Hidden
Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.