Package org.gradle.api.file

# Interface FileCopyDetails

All Superinterfaces:
  `ContentFilterable`, `Describable`, `FileTreeElement`

@NonExtensible public interface FileCopyDetails extends FileTreeElement, ContentFilterable, Describable

Provides details about a file or directory about to be copied, and allows some aspects of the destination file to be modified.

Using this interface, you can change the destination path of the file, filter the content of the file, or exclude the file from the result entirely.

Access to the source file itself after any filters have been added is not a supported operation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `exclude()`
  Excludes this file from the copy.
  `DuplicatesStrategy`
  `getDuplicatesStrategy()`
  The strategy to use if there is already a file at this file's destination.
  `String`
  `getName()`
  Returns the base name of this file at the copy destination.
  `String`
  `getPath()`
  Returns the path of this file, relative to the root of the copy destination.
  `RelativePath`
  `getRelativePath()`
  Returns the path of this file, relative to the root of the copy destination.
  `RelativePath`
  `getRelativeSourcePath()`
  Returns the path of this file, relative to the root of the containing file tree.
  `String`
  `getSourceName()`
  Returns the base name of this file at the copy source.
  `String`
  `getSourcePath()`
  Returns the path of this file, relative to the root of the containing file tree.
  `void`
  `permissions(Action<? super ConfigurableFilePermissions> configureAction)`
  Configuration action for specifying file and directory access permissions.
  `void`
  `setDuplicatesStrategy(DuplicatesStrategy strategy)`
  The strategy to use if there is already a file at this file's destination.
  `void`
  `setMode(int mode)`
  Deprecated.
  Use `permissions(Action)` instead.
  `void`
  `setName(String name)`
  Sets the destination name of this file.
  `void`
  `setPath(String path)`
  Sets the destination path of this file.
  `void`
  `setPermissions(FilePermissions permissions)`
  Set file and directory access permissions based on an externally provided permission instance.
  `void`
  `setRelativePath(RelativePath path)`
  Sets the destination path of this file.

  ### Methods inherited from interface org.gradle.api.file.ContentFilterable

  `expand, expand, filter, filter, filter, filter`

  ### Methods inherited from interface org.gradle.api.Describable

  `getDisplayName`

  ### Methods inherited from interface org.gradle.api.file.FileTreeElement

  `copyTo, copyTo, getFile, getLastModified, getMode, getPermissions, getSize, isDirectory, open`

- ## Method Details

  - ### exclude

    void exclude()
    Excludes this file from the copy.

  - ### setName

    void setName(String name)
    Sets the destination name of this file.
    Parameters:
      `name` - The destination name of this file.

  - ### setPath

    void setPath(String path)
    Sets the destination path of this file.
    Parameters:
      `path` - The path of this file.

  - ### setRelativePath

    void setRelativePath(RelativePath path)
    Sets the destination path of this file.
    Parameters:
      `path` - the new path for this file.

  - ### setMode

    @Deprecated void setMode(int mode)
    Deprecated.
    Use `permissions(Action)` instead. This method is scheduled for removal in Gradle 9.0.
    Sets the Unix permissions of this file.
    Parameters:
      `mode` - the Unix permissions, e.g. `0644`.

  - ### permissions

    void permissions(Action<? super ConfigurableFilePermissions> configureAction)
    Configuration action for specifying file and directory access permissions. For details see `ConfigurableFilePermissions`.
    Since:
      8.3

  - ### setPermissions

    void setPermissions(FilePermissions permissions)
    Set file and directory access permissions based on an externally provided permission instance. For details see `ConfigurableFilePermissions`.
    Since:
      8.3

  - ### setDuplicatesStrategy

    void setDuplicatesStrategy(DuplicatesStrategy strategy)
    The strategy to use if there is already a file at this file's destination.

  - ### getDuplicatesStrategy

    DuplicatesStrategy getDuplicatesStrategy()
    The strategy to use if there is already a file at this file's destination.

    The value can be set with a case-insensitive string of the enum value (e.g. `'exclude'` for `DuplicatesStrategy.EXCLUDE`).

    Returns:
      the strategy to use for this file.
    See Also:
      - `DuplicatesStrategy`

  - ### getName

    String getName()
    Returns the base name of this file at the copy destination.
    Specified by:
      `getName` in interface `FileTreeElement`
    Returns:
      The destination name. Never returns null.

  - ### getPath

    String getPath()
    Returns the path of this file, relative to the root of the copy destination.

    Always uses '/' as the hierarchy separator, regardless of platform file separator. Same as calling `getRelativePath().getPathString()`.

    Specified by:
      `getPath` in interface `FileTreeElement`
    Returns:
      The path, relative to the root of the copy destination. Never returns null.

  - ### getRelativePath

    RelativePath getRelativePath()
    Returns the path of this file, relative to the root of the copy destination.
    Specified by:
      `getRelativePath` in interface `FileTreeElement`
    Returns:
      The path, relative to the root of the copy destination. Never returns null.

  - ### getSourceName

    String getSourceName()
    Returns the base name of this file at the copy source.
    Returns:
      The source name. Never returns null.

  - ### getSourcePath

    String getSourcePath()
    Returns the path of this file, relative to the root of the containing file tree.

    Always uses '/' as the hierarchy separator, regardless of platform file separator. Same as calling `getRelativeSourcePath().getPathString()`.

    Returns:
      The path, relative to the root of the containing file tree. Never returns null.

  - ### getRelativeSourcePath

    RelativePath getRelativeSourcePath()
    Returns the path of this file, relative to the root of the containing file tree.
    Returns:
      The path, relative to the root of the containing file tree. Never returns null.