Purpose
Returns just the file name from a specified file. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
PathToFileName$( filespec )
filespec is a string expression representing a full file specification.
Return Value
String
Description
The PathToFileName$() function returns just the "filename" component from a full file specification.
A full file specification can include a directory and a filename. The PathToFileName$() function returns the file's name, including the file extension if there is one.
The file specification C:\MAPINFO\DATA\WORLD.TAB includes a directory ("C:\MAPINFO\DATA\") and a filename ("WORLD.TAB").
Example
Dim s_filespec, s_filename As String
s_filespec = "C:\MAPINFO\DATA\STATES.TAB"
s_filename = PathToFileName$(s_filespec)
' filename now contains the string "STATES.TAB"
See Also:
PathToDirectory$() function, PathToTableName$() function