DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Base Directory Name And Path Manipulation In Apache Ant
// The following will provide you an outline of basedirectory name and path in Apache Ant
<!--
Author : Debadatta Mishra
Description : This ant script provides the followings.
1. Full path of the base directory.
2. Root or parent path of the base directory.
3. Only Directory name of the base diectory.
-->
<project name="basedirnametest" basedir="." default="test">
<basename property=â€basedir.name†file=â€${basedir}â€/>
<property name=â€base.dir.name†value=â€${basedir.name}†/>
<dirname property=â€antfile.dir†file=â€${basedir}â€/> <!– Provides Root Path –>
<target name=â€testâ€>
<echo>Base Directory Path : ${basedir}</echo>
<echo>Base Directory Parent Path : ${antfile.dir}</echo>
<echo>Base Directory only Name : ${base.dir.name}</echo>
</target>
</project>





