B.9 Basename

Task to determine the basename of a specified file, optionally minus a specified suffix.

When this task executes, it will set the specified property to the value of the last path element of the specified file. If file is a directory, the basename will be the last directory element. If file is a full-path, relative-path, or simple filename, the basename will be the simple file name, without any directory elements.

Table B.11: Attributes

NameTypeDescriptionDefaultRequired
property String Name of the property that is to be set.n/aYes
file String The path to take the basename of.n/aYes
suffix String The suffix to remove from the resulting basename (specified either with or without the "."). n/aNo

B.9.1 Examples

<basename property="cmdname" file="./foo.exe" suffix=".exe"/>