DADiSP Worksheet Functions > Function Categories > File Manipulation > DIRPATH

 

DIRPATH

Purpose:

Returns the directory component of a path string.

Syntax:

DIRPATH("path", labflag)

(pathname, filename) = DIRPATH("path", labflag)

"path"

-

Optional. A string, a full path string containing a directory component.

labflag

-

Optional. An integer, append Labbook path if no path found:

0:

do not append Labbook path

1:

append Labbook path (default)

Returns:

A string, the directory name.

 

(pathname, filename) = DIRPATH("path") returns the path component and filename component in two separate variables.

Example:

dirpath("\dsp\system.mac")

 

returns the directory component "dsp"

Example:

(p, n) = dirpath("\dsp\system.mac")

 

p == "\dsp\"

n == "system.mac"

Remarks:

DIRPATH is used internally to retrieve the last directory in file dialog boxes - see system.mac.

 

If the path string does not contain a directory component, by default, the current LABBOOK path is returned.

 

See FILEPARTS for a generic function to obtain file name components

See Also:

EVAL

FILEPARTS

GETMISCPATH

STRFIND

STRREV

SYSTEM.MAC