SetAttribute
(
Attribute As String
);
Parameters
[in] String Attribute
Attribute you want to set for a File or Directory.
Description
Sets the attribute of a file or directory. A preceding minus sign
(-) removes an attribute.
Possible values for this parameter
READONLY |
Makes File or Directory read-only |
-READONLY |
Removes read-only attribute of File or Directory |
ARCHIVE |
Archives the File or Directory. |
-ARCHIVE |
Removes the Archive attribute of the File or Directory |
COMPRESSED |
Compresses the File or Directory |
-COMPRESSED |
Removes the Compressed attribute from the File or Directory |
HIDDEN |
Hides the File or Directory |
-HIDDEN |
Removes the Hidden attribute from the File or Directory |
SYSTEM |
Makes the file a system file |
-SYSTEM |
Removes the System attribute from the File / Directory |
Remarks
You can set only one attribute at a time. The compression attribute
is valid only for NTFS volumes on Windows NT 3.51 or above. In case
of a directory, the compression state is set for files created or
copied after the compression operation is done. Also note that
uncompressing a directory does not uncompress files or directories
inside it.
Example
Dim File As Ifile
Set File =
GetObject("NTDS://DomainName/MachineName/file_services/c-drive/documents")
File.SetAttribute "READONLY" 'makes the directory read-only
File.SetAttribute "-HIDDEN" 'removes the hidden attribute
See Also: