ASP GetFileName Method
Complete FileSystemObject object reference manual
The GetFileName method returns a string containing the file or folder name of the last component in a specified path.
Syntax
FileSystemObject.GetFileName(path)
| Parameters | Description |
|---|---|
| path | Required. The path to a specific file or folder. |
Example
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
%>
Output:
test.htm
Get the folder name:
<%
dim fs,p
set fs=Server.CreateObject("Scripting.FileSystemObject")
p=fs.getfilename("c:\test")
response.write(p)
set fs=nothing
%>
Output:
test
Complete FileSystemObject object reference manual