B.7 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.9: Attributes

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

B.7.1 Examples

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