FREE Web Template Download
HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP JQUERY ANGULARJS TUTORIALS REFERENCES EXAMPLES Blog
 

ASP GetFileName Method


FileSystemObject Object Reference Complete FileSystemObject Object Reference

The GetFileName method returns a string that contains the file name or folder name for the last component in a specified path.

Syntax

FileSystemObject.GetFileName(path)

Parameter Description
path Required. The path to a specific file or folder

Examples

Get a filename:

<%
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 a foldername:

<%
dim fs,p
set fs=Server.CreateObject("Scripting.FileSystemObject")
p=fs.getfilename("c:\test\")
response.write(p)
set fs=nothing
%>

Output:

test

FileSystemObject Object Reference Complete FileSystemObject Object Reference