ASP ShortName Property
The ASP ShortName Property is used to get the short name of the specified file or folder on the system.
Syntax:
For File Object:
FileObject.ShortName
For Folder Object:
FolderObject.ShortName
The below examples illustrate the ASP ShortName Property.
Example 1: The below code illustrates the ASP File.ShortName Property.
ASP
<%
dim fs,f
set fs=Server.CreateObject(
"Scripting.FileSystemObject"
)
'Getting the file
set f=fs.GetFile(
"d:\alargefilename.txt"
)
'Getting the full name of the file
Response.Write(
"Full Name: "
& f.Name)
'Getting the short name of the file
Response.Write(
"<br>Short Name: "
& f.ShortName)
set f=nothing
set fs=nothing
%>
Output:
Full Name: alargefilename.txt Short Name: ALARGE~1.TXT
Example 2: The below code illustrates the ASP File.ShortName Property.
ASP
<%
dim fs,fol
set fs=Server.CreateObject(
"Scripting.FileSystemObject"
)
'Getting the folder
set fol=fs.GetFolder(
"d:\geeksforgeeksfolder"
)
'Getting the full name of the folder
Response.Write(
"Full Name: "
& fol.Name)
'Getting the short name of the folder
Response.Write(
"<br>Short Name: "
& fol.ShortName)
set fol=nothing
set fs=nothing
%>
Output:
Full Name: geeksforgeeksfolder Short Name: GEEKSF~1