DirectoryName - Maple Help

MmaTranslator[Mma]

 DirectoryName
 return the directory name from a file path

 Calling Sequence DirectoryName(file path)

Parameters

 file path - string specifying the path to a file

Description

 • The DirectoryName command returns a string that gives the directory name from a file path.

Examples

 > $\mathrm{with}\left(\mathrm{MmaTranslator}\left[\mathrm{Mma}\right]\right):$

Use the command with the Maple translation.

 > $\mathrm{DirectoryName}\left("/home/UserName/file.ext"\right)$
 ${"/home/UserName/"}$ (1)
 > $\mathrm{DirectoryName}\left("C:\\Users\\MapleUser\\file.ext"\right)$
 ${"C:\Users\MapleUser\"}$ (2)

Alternatively, you can use the FromMma command with the evaluate option specified.

 > $\mathrm{with}\left(\mathrm{MmaTranslator}\right):$
 > $\mathrm{FromMma}\left(\mathrm{DirectoryName\left[ "C:\Users\MapleUser\file.ext" \right]},\mathrm{evaluate}\right)$
 ${"C:\Users\MapleUser\"}$ (3)

Compatibility

 • The MmaTranslator[Mma][DirectoryName] command was updated in Maple 2017.