# directory::get-parent-directory

Retrieves the parent directory of the specified path.

### Usage

`string directory::get-parent-directory(path)`

### Parameters

Name | Type | Description
--- | --- | ---
path | string | The path for which to retrieve the parent directory.

### Return Value

The parent directory, or an empty String if path is the root directory, including the root of a UNC server or share name.

### Exceptions

The function will fail in any of the following circumstances:

- The directory specified by path is read-only.
- path is a zero-length string, contains only white space, or contains one or more invalid characters.
- The specified path, file name, or both exceed the system-defined maximum length.
- The specified path was not found.

### Examples

- Copy "readme.txt" from the current working directory to its parent directory.

      <property name="current.dir" value="${directory::get-current-directory()}" />
      <property name="current.dir.parent" value="${directory::get-parent-directory(current.dir)}" />
      <copy file="${path::combine(current.dir, 'readme.txt')} todir="${current.dir.parent}" />

### Requirements

Assembly: NAnt.Core (0.92.4543.0)