The ASP Name Property is used for returning and setting the name of a specified file or Folder.
Syntax:
- For File Object:
FileObject.Name[=newname]- For Folder Object:
FolderObject.Name[=newname] Parameter Values:
- newname: It is an optional attribute. It specifies the new name of the file or folder.
Example-1: Below code returns the name of the File.
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("d:\GFG.txt")
Response.Write("The name of the file is: ")
Response.Write(f.Name)
set f=nothing
set fs=nothing
%>
Output:
The name of the file is GFG.txt Example -2: Below code returns the name of the Folder.
<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("d:\GFG")
Response.Write("The name of the folder is: ")
Response.Write(fo.Name)
set fo=nothing
set fs=nothing
%>
Output:
The name of the folder is : GFG