Package org.gradle.api.file

## Interface Directory

- All Superinterfaces:
    `FileSystemLocation`

      @Incubating
      public interface Directory
      extends FileSystemLocation

  Represents a directory at some fixed location on the file system.

  Note: This interface is not intended for implementation by build script or plugin authors. An instance of this class can be created using the `dir(String)` method or using various methods on `ProjectLayout` such as `ProjectLayout.getProjectDirectory()`.

  Since:
    4.1

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Directory` | `dir​(String path)` | Returns a `Directory` whose location is the given path, resolved relative to this directory.
    `Provider<Directory>` | `dir​(Provider<? extends CharSequence> path)` | Returns a `Provider` whose value is a `Directory` whose location is the given path resolved relative to this directory.
    `RegularFile` | `file​(String path)` | Returns a `RegularFile` whose location is the given path, resolved relative to this directory.
    `Provider<RegularFile>` | `file​(Provider<? extends CharSequence> path)` | Returns a `Provider` whose value is a `RegularFile` whose location is the given path resolved relative to this directory.
    `File` | `getAsFile()` | Returns the location of this directory, as an absolute `File`.
    `FileTree` | `getAsFileTree()` | Returns a `FileTree` that allows the files and directories contained in this directory to be queried.

- - ### Method Detail

    - #### getAsFile

          File getAsFile()

      Returns the location of this directory, as an absolute `File`.
      Specified by:
        `getAsFile` in interface `FileSystemLocation`
      Returns:
        the File
      Since:
        4.2

    - #### getAsFileTree

          FileTree getAsFileTree()

      Returns a `FileTree` that allows the files and directories contained in this directory to be queried.

    - #### dir

          Directory dir​(String path)

      Returns a `Directory` whose location is the given path, resolved relative to this directory.
      Parameters:
        `path` - The path. Can be absolute.
      Returns:
        The directory.

    - #### dir

          Provider<Directory> dir​(Provider<? extends CharSequence> path)

      Returns a `Provider` whose value is a `Directory` whose location is the given path resolved relative to this directory.

      The return value is live and the provided `path` is queried each time the return value is queried.

      Parameters:
        `path` - The path provider. Can have value that is an absolute path.
      Returns:
        The provider.

    - #### file

          RegularFile file​(String path)

      Returns a `RegularFile` whose location is the given path, resolved relative to this directory.
      Parameters:
        `path` - The path. Can be absolute.
      Returns:
        The file.

    - #### file

          Provider<RegularFile> file​(Provider<? extends CharSequence> path)

      Returns a `Provider` whose value is a `RegularFile` whose location is the given path resolved relative to this directory.

      The return value is live and the provided `path` is queried each time the return value is queried.

      Parameters:
        `path` - The path provider. Can have value that is an absolute path.
      Returns:
        The file.