FileTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Input and Output : File Manipulation : FileTools : FileTools/Extension

FileTools

  

Extension

  

get file extension from filepath

  

Basename

  

get base name from filepath

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Extension(path,options)

Basename(path)

Parameters

path

-

string; filepath, relative or absolute

options

-

(optional) options as specified below

Options

• 

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.

Description

• 

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.

Examples

FileTools:-ExtensionsampleData.csv

csv

(1)

FileTools:-BasenamesampleData.csv

sampleData

(2)

The following path does not correspond to an existing file.

FileTools:-Basename/Images/Butterfly.jpg

Butterfly

(3)

FileTools:-Extension/Images/Butterfly.jpg

jpg

(4)

FileTools:-Extension/Images/Butterfly.jpg,uppercase

JPG

(5)

Compatibility

• 

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

FileTools[Filename]