Filename - Maple Help

FileTools

 Filename
 get filename from filepath
 ParentDirectory
 get parent directory from filepath

 Calling Sequence Filename(path) ParentDirectory(path)

Parameters

 path - string; filepath, relative or absolute

Description

 • The Filename and ParentDirectory commands return the filename and the parent directory, respectively, of the file referenced by the filepath path.
 • The filepath path must be syntactically correct, but is not required to correspond to an existing file or directory.
 • The behavior of this command may dependent on the platform on which it is executed and the character used to delimit directories on the current platform.

Examples

 > $\mathrm{datafile}≔\mathrm{FileTools}\left[\mathrm{JoinPath}\right]\left(\left["Excel/ExperimentalData.xls"\right],\mathrm{base}=\mathrm{datadir}\right):$
 > $\mathrm{FileTools}\left[\mathrm{Filename}\right]\left(\mathrm{datafile}\right)$
 ${"ExperimentalData.xls"}$ (1)

The following path does not correspond to an existing file.

 > $\mathrm{FileTools}\left[\mathrm{Filename}\right]\left("/friends/romans/countrymen"\right)$
 ${"countrymen"}$ (2)
 > $\mathrm{FileTools}\left[\mathrm{ParentDirectory}\right]\left("/friends/romans/countrymen"\right)$
 ${"/friends/romans"}$ (3)