FileTools
Extension
get file extension from filepath
Basename
get base name from filepath
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Extension(path,options)
Basename(path)
path
-
string; filepath, relative or absolute
options
(optional) options as specified below
uppercase=truefalse
If true, return the file extension in uppercase. As file extensions may be in mixed case, this option may simplify code handling file extensions.
The Extension and Basename commands return the extension and base name, respectively, of the file referenced by the filepath, path.
Extension("name.ext") returns "ext" and Basename("name.ext") returns "name". Both commands omit any directories listed in path.
The filepath, path, must be syntactically correct but is not required to correspond to an existing file or directory.
FileTools:-Extension⁡sampleData.csv
csv
FileTools:-Basename⁡sampleData.csv
sampleData
The following path does not correspond to an existing file.
FileTools:-Basename⁡/Images/Butterfly.jpg
Butterfly
FileTools:-Extension⁡/Images/Butterfly.jpg
jpg
FileTools:-Extension⁡/Images/Butterfly.jpg,uppercase
JPG
The FileTools[Extension] and FileTools[Basename] commands were introduced in Maple 18.
For more information on Maple 18 changes, see Updates in Maple 18.
The FileTools[Basename] command was updated in Maple 2017.
See Also
FileTools[Filename]
Download Help Document