Thuộc tính tên ASP


❮ Toàn bộ tham chiếu đối tượng thư mục

Thuộc tính Name được sử dụng để đặt hoặc trả về tên của một tệp hoặc thư mục được chỉ định.


Cú pháp

FileObject.Name[=newname]

FolderObject.Name[=newname]

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

Ví dụ cho đối tượng Tệp

<%
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

Ví dụ cho đối tượng Thư mục

<%
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

❮ Toàn bộ tham chiếu đối tượng thư mục