PathToFileName$() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

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