Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

ASP GetFileName Method


❮ 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

❮ Complete FileSystemObject Object Reference