PathToDirectory$() 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 only the specified file's directory. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

PathToDirectory$( filespec ) 

filespec is a string expression representing a full file specification.

Return Value

String

Description

The PathToDirectory$() function returns just the "directory" component from a full file specification.

A full file specification can include a directory and a filename. The file specification C:\MAPINFO\DATA\WORLD.TAB includes the directory "C:\MAPINFO\DATA\".

Example

Dim s_filespec, s_filedir As String 
s_filespec = "C:\MAPINFO\DATA\STATES.TAB" 
s_filedir = PathToDirectory$(s_filespec) 

' s_filedir now contains the string "C:\MAPINFO\DATA\"

See Also:

PathToFileName$() function, PathToTableName$() function