ASP GetFileName method
GetFileName method returns a string containing the specified file name or file path to the folder of the last component of the name.
grammar
FileSystemObject.GetFileName(path)
参数 | 描述 |
---|---|
path | 必需的。指向具体文件或文件夹的路径。 |
Examples
Get the file name:
<%
dim fs,p
set fs=Server.CreateObject("Scripting.FileSystemObject")
p=fs.getfilename("c:\test\test.htm")
response.write(p)
set fs=nothing
%>
输出:
test.htm
dim fs,p
set fs=Server.CreateObject("Scripting.FileSystemObject")
p=fs.getfilename("c:\test\test.htm")
response.write(p)
set fs=nothing
%>
输出:
test.htm
Get folder name:
<%
dim fs,p
set fs=Server.CreateObject("Scripting.FileSystemObject")
p=fs.getfilename("c:\test\")
response.write(p)
set fs=nothing
%>
输出:
test
dim fs,p
set fs=Server.CreateObject("Scripting.FileSystemObject")
p=fs.getfilename("c:\test\")
response.write(p)
set fs=nothing
%>
输出:
test
Complete FileSystemObject Object Reference