ASP ParentFolder 属性

定义和用法

ParentFolder 属性用于为指定的文件或文件夹的父文件夹返回 folder 对象。

语法:

FileObject.ParentFolder
FolderObject.ParentFolder

实例

针对 File 对象的例子

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("d:\asp\test\test.asp")
Response.Write("The file test.asp is in the folder: ")
Response.Write(f.ParentFolder)
set f=nothing
set fs=nothing
%>

输出:

The file test.asp is in the folder: D:\asp\test

针对 Folder 对象的例子

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("d:\asp\test")
Response.Write("The folder test is in the folder: ")
Response.Write(fo.ParentFolder)
set fo=nothing
set fs=nothing
%>

输出:

The folder test is in the folder: D:\asp
目录