Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

ASP Name Property


❮ Complete File Object Reference

The Name property is used to set or return the name of a specified file or folder.


Syntax

FileObject.Name[=newname]

FolderObject.Name[=newname]

Parameter Description
newname Optional. Specifies the name of the file or folder

Example for the File object

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.txt")
Response.Write("The file's name: ")
Response.Write(f.Name)
set f=nothing
set fs=nothing
%>

Output:

The file's name: test.txt

Example for the Folder object

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
Response.Write("The folder's name: ")
Response.Write(fo.Name)
set fo=nothing
set fs=nothing
%>

Output:

The folder's name: test

❮ Complete File Object Reference