ASP ParentFolder 属性
ASP ParentFolder 属性用于返回指定文件或文件夹的父文件夹的完整路径。
句法:
对于文件对象:
FileObject.ParentFolder
对于文件夹对象:
FolderObject.ParentFolder
下面的示例说明了ASP ParentFolder 属性。
示例 1: 下面的代码演示了 File.ParentFolder 属性。
ASP
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
'Getting the given file
set f=fs.GetFile("d:\GFG\sudo\test.asp")
Response.Write("The file test.asp is in the folder: ")
'Getting the parent folder of the file
Response.Write(f.ParentFolder)
set f=nothing
set fs=nothing
%>
ASP
<%
dim fs,fol
set fs=Server.CreateObject("Scripting.FileSystemObject")
'Getting the given folder
set fol=fs.GetFolder("D:\GFG\sudo")
Response.Write("The 'sudo' folder is in the folder: ")
'Getting the parent folder of the file
Response.Write(fol.ParentFolder)
set fol=nothing
set fs=nothing
%>
输出:
The file test.asp is in the folder: d:\GFG\sudo
示例 2: 下面的代码演示了 Folder.ParentFolder 属性。
ASP
<%
dim fs,fol
set fs=Server.CreateObject("Scripting.FileSystemObject")
'Getting the given folder
set fol=fs.GetFolder("D:\GFG\sudo")
Response.Write("The 'sudo' folder is in the folder: ")
'Getting the parent folder of the file
Response.Write(fol.ParentFolder)
set fol=nothing
set fs=nothing
%>
输出:
The 'sudo' folder is in the folder: D:\GFG