## Dirname

### Description

Task to determine the directory path of a specified file.

When this task executes, it will set the specified property to the value of the specified file up to, but not including, the last path element. If the specified file is a path that ends in a filename, the filename will be dropped. If the specified file is just a filename, the directory will be the current directory.

### Parameters

Attribute | Description | Required
file | The path to take the dirname of. | Yes
property | The name of the property to set. | Yes

### Examples

      <dirname property="antfile.dir" file="${ant.file}"/>

will set `antfile.dir` to the directory path for `${ant.file}`.

      <dirname property="foo.dirname" file="foo.txt"/>

will set `foo.dirname` to the project's basedir.

Copyright © 2002 Apache Software Foundation. All rights Reserved.