VBScript » Folder » Attributes

Version: 3.0

Syntax:
object.Attributes [= newattribute]

This property allows us to get or change the various attributes of a file.

The available attribute values are listed below.

Attribute Values

Name

Value

Description

Read/Write attribute

Normal

0

Normal file

Read/write

ReadOnly

1

Read-only file

Read only

Hidden

2

Hidden file

Read/write

System

4

System file

Read/write

Volume

8

Disk drive volume label

Read only

Directory

16

Folder or directory

Read-only

Archive

32

File has changed since last backup

Read/write

Alias

64

Link or shortcut

Read-only

Compressed

2048

Compressed file

Read-only

Examples

Code:
<%
dim filesys, demofolder
set filesys = CreateObject("Scripting.FileSystemObject")
set demofolder = filesys.GetFolder("c:\Projects\")
If Not demofolder.Attributes And 1 Then
Response.Write "The folder is Read/Write."
Else
Response.Write "The folder is Read-only."
End If
%>
Output:
"The folder is Read/Write."
Explanation:

This code shows how to check if a folder is read/write or read-only. As you can see, logical operators are used to get or change the various attributes.