<dirname>
The <dirname> task complements the <basename> task. It returns the path up to, but not including, the last element in the path. So, you can set a property to the directory path of a file. Table 4.29 details the attributes of this simple-to-use task.
Attributes (Required) | Description |
---|---|
file | The file to find the directory path of. |
property | The property to set. |
Example
This example will set the dirpath property to the directory path of C:\javadevelopment\misc\build.xml, which is C:\javadevelopment\misc.
<dirname file="C:\javadevelopment\misc\build.xml" property="dirpath"/>
Get Ant Developer’s Handbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.