Dirname (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs, class: Dirname

Package org.apache.tools.ant.taskdefs

# Class Dirname

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.Dirname

All Implemented Interfaces:
  `Cloneable`

public class Dirname extends Task
Determines the directory name of the specified file. This task can accept the following attributes:

- file
- property

Both file and property are required.

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 file is a file, the directory will be the current directory.

Since:
  Ant 1.5

- ## Field Summary

  ### Fields inherited from class org.apache.tools.ant.Task

  `target, taskName, taskType, wrapper`

  ### Fields inherited from class org.apache.tools.ant.ProjectComponent

  `description, location, project`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Dirname()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `execute()`
  Execute this task.
  `void`
  `setFile​(File file)`
  Path to take the dirname of.
  `void`
  `setProperty​(String property)`
  The name of the property to set.

  ### Methods inherited from class org.apache.tools.ant.Task

  `bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

  ### Methods inherited from class org.apache.tools.ant.ProjectComponent

  `clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Dirname

    public Dirname()

- ## Method Details

  - ### setFile

    public void setFile​(File file)
    Path to take the dirname of.
    Parameters:
      `file` - a `File` value

  - ### setProperty

    public void setProperty​(String property)
    The name of the property to set.
    Parameters:
      `property` - the name of the property

  - ### execute

    public void execute() throws BuildException
    Execute this task.
    Overrides:
      `execute` in class `Task`
    Throws:
      `BuildException` - on error