Apache ANT Tasks Tutorial
Selected Reading
- Ant Tasks - Discussion
- Ant Tasks - Useful Resources
- Ant Tasks - Quick Guide
- ANT Tasks -JAR
- ANT Tasks - Zip
- ANT Tasks - WAR
- ANT Tasks - Sleep
- ANT Tasks - Move
- ANT Tasks - MkDir
- ANT Tasks - LoadFile
- ANT Tasks - Length
- ANT Tasks - Javac
- ANT Tasks - Java
- ANT Tasks - Import
- ANT Tasks - Fail
- ANT Tasks - EAR
- ANT Tasks - Delete
- ANT Tasks - Copy
- ANT Tasks - Condition
- ANT Tasks - Concat
- ANT Tasks - Chmod
- ANT Tasks - GUnzip
- ANT Tasks - GZip
- ANT Tasks - BaseName
- ANT Tasks - Environment Setup
- ANT Tasks - Introduction
- ANT Tasks - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
ANT Tasks - BaseName
Apache Ant Tasks - BaseName
Description
Basename task determines the base name of the specified file/directory while removing the suffix if passed. In case of full path of file, the name of the file is used. In case of directory path, the name of the last directory is used.
Properties
Sr.No | Attributes & Description |
---|---|
1 | File The path to take the basename of. (Mandatory) |
2 | Property The name of the property to set. (Mandatory) |
3 | Suffix The suffix to remove from the resulting basename (specified either with or without the .). (Optional) |
Example
Usage
Create build.xml with the following content −
<?xml version="1.0"?> <project name="TutorialPoint" default="info"> <target name="info"> <basename property="cmdname" file="D:/usr/local/apppcation.exe" suffix=".exe"/> <echo message="${cmdname}"></echo> </target> </project>
Output
Running Ant on the above build file produces the following output −
F: utorialspointant>ant Buildfile: F: utorialspointantuild.xml info: [echo] apppcation BUILD SUCCESSFUL Total time: 0 secondsAdvertisements