FILEPARTS

Purpose:

Returns the directory, filename and extension of a path string.

Syntax:

FILEPARTS("pathname")

(path, filename, ext) = FILEPARTS("pathname")

"pathname"

-

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

Returns:

A string, the directory name.

 

(path, filename) = FILEPARTS("pathname") returns the path component and filename with extension.

 

(path, filename, ext) = FILEPARTS("pathname") returns the path component, filename without extension and the file extension (if any) with a leading period ( . ).

Example:

fileparts("\dsp\system.mac")

 

returns the directory component "\dsp"

Example:

(path, fname) = fileparts("\dsp\system.mac")

 

path  == "\dsp"

fname == "system.mac"

Example:

(path, fname, ext) = fileparts("\dsp\system.mac")

 

path  == "\dsp"

fname == "system"

ext   == ".mac"

Remarks:

The returned path component does not contain a trailing path separator.

 

The extension component contains a leading period if it exists.

 

The file specified by "pathname" does not have to exist.

See Also:

DIRPATH

STRFIND

STRREVERSE