Open In App

ASP ParentFolder Property

The ASP ParentFolder Property is used to return the complete path for the parent folder of a specified file or folder.

Syntax:



The below examples illustrate the ASP ParentFolder Property.

Example 1: The below code demonstrates the File.ParentFolder Property. 




<%
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
%>

Output:

The file test.asp is in the folder: d:\GFG\sudo

Example 2: The below code demonstrates the Folder.ParentFolder Property.




<%
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
%>

Output:

The 'sudo' folder is in the folder: D:\GFG
Article Tags :