Version: 3.0
This property allows us to get or change the various attributes of a file.
The available attribute values are listed below.
File 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 |
<%
dim filesys, text, readfile
set filesys = CreateObject("Scripting.FileSystemObject")
Set text = filesys.CreateTextFile("c:\somefile2.txt")
text.Write "A simple test to find if this file is writeable."
text.close
set readfile = filesys.GetFile("c:\somefile2.txt")
If Not readfile.Attributes And 1 Then
Response.Write "The file is Read/Write."
Else
Response.Write "The file is Read-only."
End If
%>
"The file is Read/Write."This code shows how to check if a file is read/write or read-only. As you can see, logical operators are used to get or change the various attributes.