Apache Ant TasksBasenameBasenameDescriptionTask to determine the basename of a specified file, optionally minus aspecified suffix. When this task executes, it will set the specified property to thevalue of the last path element of the specified file. If file is adirectory, the basename will be the last directory element. Iffile is a full-path, relative-path, or simple filename,the basename will be the simple file name, without any directory elements. Parameters Attribute | Description | Required | file | The path to take the basename of. | Yes | property | The name of the property to set. | Yes | suffix | The suffix to remove from the resulting basename (specified either with or without the ". "). | No | Examples<basename property="jar.filename" file="${lib.jarfile}"/> will set jar.filename tomyjar.jar , if lib.jarfile is defined as either afull-path filename (eg., /usr/local/lib/myjar.jar ),a relative-path filename (eg., lib/myjar.jar ),or a simple filename (eg., myjar.jar ).<basename property="cmdname" file="D:/usr/local/foo.exe" suffix=".exe"/> will set cmdname to foo .<property environment="env"/><basename property="temp.dirname" file="${env.TEMP}"/> will set temp.dirname to the last directory element ofthe path defined for the TEMP environment variable. |