Skip to content

dos_splitpath

Dale Fugier edited this page Jul 1, 2026 · 1 revision

Breaks a full path name into its four components. The function returns a list containing the four components.

Syntax

(dos_splitpath path)

Parameters

path

A string containing a qualified path.

Returns

A list containing the following elements:

Value Description
drive The drive letter followed by a colon (:) if a drive is specified in path.
directory The path of subdirectories, if any, including the trailing backslashes. Forward slashes (/), double-backslashes (\), or both may be present in path.
filename The base file name without any extension.
extension The file name extension, if any, including the leading period.

nil on error.

Examples

Command: (dos_splitpath "C:\\Program Files\\AutoCAD 2006\\acad.exe")
("C:" "\\Program Files\\AutoCAD 2006\\" "acad" ".exe")

Command: (dos_splitpath "C:\\Program Files\\AutoCAD 2006\\")
("C:" "\\Program Files\\AutoCAD 2006\\" "" "")

Clone this wiki locally