ASP Attributes 屬性


File 對象參考手冊 完整的 File 對象參考手冊

Attributes 屬性用於設置或返回指定檔或檔夾的屬性。

語法

FileObject.Attributes[=newattributes]

FolderObject.Attributes[=newattributes]

參數 描述
newattributes 可選的。規定檔或檔夾的屬性值。

可採用下列值之一或者下列值的組合:

0 = 普通檔。
1 = 只讀檔。
2 = 隱藏檔。
4 = 系統檔。
16 = 檔夾或目錄。
32 = 上次備份後已更改的檔。
1024 = 鏈接或快捷方式。
2048 = 壓縮檔。

針對 File 對象的實例

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.txt")
Response.Write("The attributes of the file are: ")
Response.Write(f.Attributes)
set f=nothing
set fs=nothing
%>

輸出:

The attributes of the file are: 32

針對 Folder 對象的實例

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
Response.Write("The attributes of the folder are: ")
Response.Write(fo.Attributes)
set fo=nothing
set fs=nothing
%>

輸出:

The attributes of the folder are: 16


File 對象參考手冊 完整的 File 對象參考手冊