ASP 类型属性
ASP 类型属性用于返回特定文件或文件夹的类型。它返回文件或文件夹类型的完整名称。
句法:
对于文件对象:
FileObject.Type
对于文件夹对象:
FolderObject.Type
下面的示例演示了 ASP 类型属性。
示例 1:
ASP
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
'Getting the file
set f=fs.GetFile("d:\GFG.txt")
Response.Write("The file GFG.txt is of type: ")
'Getting the type of the file
Response.Write(f.Type)
set f=nothing
set fs=nothing
%>
ASP
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
'Getting the file
set f=fs.GetFile("d:\GFG.asp")
Response.Write("The file GFG.asp is of type: ")
'Getting the type of the file
Response.Write(f.Type)
set f=nothing
set fs=nothing
%>
ASP
<%
dim fs,fol
set fs=Server.CreateObject("Scripting.FileSystemObject")
'Getting the required folder
set fol=fs.GetFolder("d:\GFG")
'Getting the type of the folder
Response.Write("The type of the folder is: " & fol.Type)
set fol=nothing
set fs=nothing
%>
输出:
The file GFG.txt is of type: Text Document
示例 2:
ASP
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
'Getting the file
set f=fs.GetFile("d:\GFG.asp")
Response.Write("The file GFG.asp is of type: ")
'Getting the type of the file
Response.Write(f.Type)
set f=nothing
set fs=nothing
%>
输出:
The file GFG.asp is of type: Active Server Document
示例 3:下面的代码演示了 ASP Folder.Type 属性。
ASP
<%
dim fs,fol
set fs=Server.CreateObject("Scripting.FileSystemObject")
'Getting the required folder
set fol=fs.GetFolder("d:\GFG")
'Getting the type of the folder
Response.Write("The type of the folder is: " & fol.Type)
set fol=nothing
set fs=nothing
%>
输出:
The type of the folder is: File folder