Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ASP GetFileName Method

ASP GetFileName Method


FileSystemObject Reference 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


FileSystemObject Reference Complete FileSystemObject object reference manual