Open In App

ASP ShortPath Property

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

The ASP ShortPath Property is used to return the short path for the specified file or folder.

Syntax:

  • For File Object:

    FileObject.ShortPath
  • For Folder Object:

    FolderObject.ShortPath

The below examples demonstrate the ASP ShortPath Property.

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

ASP




<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Get the file to be used
set f=fs.GetFile("D:\geeksforgeeksfolder\gfglongfilename.txt")
  
'Get the full path of the file
Response.Write("Full Path: " & f.Path)
  
'Get the short path of the file
Response.Write("<br>Short Path: " & f.ShortPath)
  
set f=nothing
set fs=nothing
%>


Output:

Full Path: D:\geeksforgeeksfolder\gfglongfilename.txt
Short Path: D:\GEEKSF~1\GFGLON~1.TXT

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

ASP




<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the folder to be used
set f=fs.GetFolder("D:\geeksforgeeksfolder")
  
'Get the full path of the folder
Response.Write("Full Path: " & f.Path)
  
'Get the short path of the folder
Response.Write("<br>Short Path: " & f.ShortPath)
  
set f=nothing
set fs=nothing
%>


Output:

Full Path: D:\geeksforgeeksfolder
Short Path: D:\GEEKSF~1

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads