SplitPath()

Summary

Splits a path and filename into its component parts.

Syntax

parts = SplitPath(string path)

Argument Contents
path A path and filename

Returns

An array of the four component parts of the path.

Element Type Contents
1 String The drive letter, followed by a colon
2 String The directory, with trailing backslash
3 String The filename, without extension
4 String The extension, including leading period

Notes

  • The returned parts include only those portions of the path that are included in the input string. For example, if the input string is a partial path without a drive letter, then the first element of the returned array is null.

Example

prts1 = SplitPath("c:\\data\\myfile.dbf")
// prts1 = {"C:", "\DATA\", "MYFILE", ".DBF"}
prts2 = SplitPath("myfile.dbf")
// prts2 = {null, null, "MYFILE", ".DBF"}

See Also

Function Summary
GetFilenamePart() Gets a part of a file path or folder name
GetLongPathName() Returns the full, long pathname for a file
GetShortPathName() Returns the short pathname for a file
ParseString() Divides a string into pieces separated by the specified delimiters
SplitString() Divides a string into pieces based on the position of vertical bars (|) in that string