Open In App

ASP Path Property

Improve
Improve
Like Article
Like
Save
Share
Report

The ASP Path Property is used to get the complete path for a specified file, folder, or drive on the system.

Syntax:

  • For File Object

    FileObject.Path
  • For Folder Object:

    FolderObject.Path

For Drive Object:

DriveObject.Path

The below examples demonstrate the ASP Path Property.

Example 1: The below code illustrates the ASP File.Path Property.

ASP




<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the given file
set f=fs.GetFile("d:\GFG\sudo\geeks.asp")
  
'Getting the path of the file
Response.Write("Complete path for the specified file: " & f.Path)
  
set f=nothing
set fs=nothing
%>


Output:

Complete path for the specified file: d:\GFG\sudo\geeks.asp

Example 2: The below code illustrates the ASP Folder.Path Property.

ASP




<%
dim fs,fol
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the required folder
set fol=fs.GetFolder("d:\GFG\geeks")
  
'Getting the complete path of the folder
Response.Write("The path of the folder is " & fol.Path)
  
set fol=nothing
set fs=nothing
%>


Output:

The path of the folder is D:\GFG\geeks

Example 3: The below code illustrates the ASP Drive.Path Property.

ASP




<%
dim fs,drive
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Get the required drive
set drive=fs.GetDrive("d:")
  
'Finding the path of the drive
Response.Write("The path of the drive is: " & drive.Path)
  
set drive=nothing
set fs=nothing
%>


Output:

The path of the drive is: D:


Last Updated : 24 Mar, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads