DADiSP Worksheet Functions > Function Categories > File Manipulation > FILEPARTS
Returns the directory, filename and extension of a path string.
FILEPARTS("pathname")
(path, filename, ext) = FILEPARTS("pathname")
"pathname" |
- |
A string, a full path string containing a directory component. |
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 ( . ).
fileparts("\dsp\system.mac")
returns the directory component "\dsp"
(path, fname) = fileparts("\dsp\system.mac")
path == "\dsp"
fname == "system.mac"
(path, fname, ext) = fileparts("\dsp\system.mac")
path == "\dsp"
fname == "system"
ext == ".mac"
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.