一聚教程网:一个值得你收藏的教程网站

热门教程

ASP IsRootFolder 与 Drive属性实例教程

时间:2022-06-30 11:43:05 编辑:袖梨 来源:一聚教程网

ASP fso 的IsRootFolder 与 FIilesystemobject Drive属性我们先来看看fso dirve属性用法 吧.

该驱动器使用的财产归还盘符驱动器在指定的文件或文件夹所在。

语法
FileObject.Drive
FolderObject.Drive
 

例如File对象

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:test.txt")
Response.Write("File resides on drive: ")
Response.Write(f.Drive)
set f=nothing
set fs=nothing
%>
Output:

File resides on drive: c:
文件夹测试实例.
<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:test")
Response.Write("Folder resides on drive: ")
Response.Write(fo.Drive)
set fo=nothing
set fs=nothing
%>Output:Folder resides on drive: c:下面来对asp fso isrootfolder判断当前目录是否为根目录.该IsRootFolder财产返回true ,如果指定的文件夹的根文件夹和虚假如果不是。 语法FolderObject.IsRootFolder 例如<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:asptest")
if fo.IsRootFolder=true then
   Response.Write("The folder is the root folder!")
else
   Response.Write("The folder is not the root folder!")
end if
set fo=nothing
set fs=nothing
%>Output:The folder is not the root folder!

热门栏目