Open In App

ASP ParentFolder Property

Last Updated : 25 Mar, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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

Syntax:

  • For File Object:

    FileObject.ParentFolder
  • For Folder Object:

    FolderObject.ParentFolder

The below examples illustrate the ASP ParentFolder Property.

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

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


Output:

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

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

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


Output:

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

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads