PathFileName Procedure

Gets the filename part of a path, dropping the directory part. Use PathDirectoryName to return the directory part of the path.
This is done by extracting the last path component from the string. No disk access is performed and the path does not need to actually exist.
Declaration
function PathFileName(path as String) as String

Parameters

Return value

String — Last path component.

Example

Code
' this result depends on your operating system
dim path = "C:\Users\user\Documents\myfile.txt"
print PathDirectoryName(path)
print PathFileName(path)
Output
C:\Users\user\Documents
myfile.txt