FileSystemOperations (Gradle API 8.14.2)
Description: declaration: package: org.gradle.api.file, interface: FileSystemOperations

Package org.gradle.api.file

# Interface FileSystemOperations

@ServiceScope({org.gradle.internal.service.scopes.Scope.Build.class,org.gradle.internal.service.scopes.Scope.Project.class}) public interface FileSystemOperations
Operations on the file system.

An instance of this type can be injected into a task, plugin or other object by annotating a public constructor or property getter method with `javax.inject.Inject`.

Since:
  6.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `WorkResult`
  `copy(Action<? super CopySpec> action)`
  Copies the specified files.
  `CopySpec`
  `copySpec()`
  Creates a `CopySpec` which can later be used to copy files or create an archive.
  `CopySpec`
  `copySpec(Action<? super CopySpec> action)`
  Creates a `CopySpec` which can later be used to copy files or create an archive.
  `WorkResult`
  `delete(Action<? super DeleteSpec> action)`
  Deletes the specified files.
  `ConfigurableFilePermissions`
  `directoryPermissions(Action<? super ConfigurableFilePermissions> configureAction)`
  Creates and configures directory access permissions.
  `ConfigurableFilePermissions`
  `filePermissions(Action<? super ConfigurableFilePermissions> configureAction)`
  Creates and configures file access permissions.
  `ConfigurableFilePermissions`
  `permissions(int unixNumeric)`
  Creates file/directory access permissions and initializes them via a Unix style numeric permissions.
  `ConfigurableFilePermissions`
  `permissions(String unixNumericOrSymbolic)`
  Creates file/directory access permissions and initializes them via a Unix style permission string.
  `Provider<ConfigurableFilePermissions>`
  `permissions(Provider<String> permissions)`
  `Provider` based version of `permissions(String)`, to facilitate wiring into property chains.
  `WorkResult`
  `sync(Action<? super SyncSpec> action)`
  Synchronizes the contents of a destination directory with some source directories and files.

- ## Method Details

  - ### copySpec

    @Incubating CopySpec copySpec(Action<? super CopySpec> action)
    Creates a `CopySpec` which can later be used to copy files or create an archive. The given action is used to configure the `CopySpec` before it is returned by this method.
    Parameters:
      `action` - Action to configure the CopySpec
    Returns:
      The CopySpec
    Since:
      8.5

  - ### copySpec

    @Incubating CopySpec copySpec()
    Creates a `CopySpec` which can later be used to copy files or create an archive.
    Returns:
      a newly created copy spec
    Since:
      8.5

  - ### copy

    WorkResult copy(Action<? super CopySpec> action)
    Copies the specified files. The given action is used to configure a `CopySpec`, which is then used to copy the files.
    Parameters:
      `action` - Action to configure the CopySpec
    Returns:
      `WorkResult` that can be used to check if the copy did any work.

  - ### sync

    WorkResult sync(Action<? super SyncSpec> action)
    Synchronizes the contents of a destination directory with some source directories and files. The given action is used to configure a `SyncSpec`, which is then used to synchronize the files.
    Parameters:
      `action` - action Action to configure the SyncSpec.
    Returns:
      `WorkResult` that can be used to check if the sync did any work.

  - ### delete

    WorkResult delete(Action<? super DeleteSpec> action)
    Deletes the specified files. The given action is used to configure a `DeleteSpec`, which is then used to delete the files.
    Parameters:
      `action` - Action to configure the DeleteSpec
    Returns:
      `WorkResult` that can be used to check if delete did any work.

  - ### filePermissions

    ConfigurableFilePermissions filePermissions(Action<? super ConfigurableFilePermissions> configureAction)
    Creates and configures file access permissions. Differs from directory permissions due to the default value the permissions start out with before the configuration is applied. For details see `ConfigurableFilePermissions`.
    Parameters:
      `configureAction` - The configuration that gets applied to the newly created `FilePermissions`.
    Since:
      8.3

  - ### directoryPermissions

    ConfigurableFilePermissions directoryPermissions(Action<? super ConfigurableFilePermissions> configureAction)
    Creates and configures directory access permissions. Differs from file permissions due to the default value the permissions start out with before the configuration is applied. For details see `ConfigurableFilePermissions`.
    Parameters:
      `configureAction` - The configuration that gets applied to the newly created `FilePermissions`.
    Since:
      8.3

  - ### permissions

    ConfigurableFilePermissions permissions(String unixNumericOrSymbolic)
    Creates file/directory access permissions and initializes them via a Unix style permission string. For details see `ConfigurableFilePermissions.unix(String)`.

    Doesn't have separate variants for files and directories, like other configuration methods, because the Unix style permission input completely overwrites the default values, so the distinction doesn't matter.

    Since:
      8.3

  - ### permissions

    ConfigurableFilePermissions permissions(int unixNumeric)
    Creates file/directory access permissions and initializes them via a Unix style numeric permissions. For details see `ConfigurableFilePermissions.unix(int)`.

    Doesn't have separate variants for files and directories, like other configuration methods, because the Unix style permission input completely overwrites the default values, so the distinction doesn't matter.

    Since:
      8.3

  - ### permissions

    Provider<ConfigurableFilePermissions> permissions(Provider<String> permissions)
    `Provider` based version of `permissions(String)`, to facilitate wiring into property chains.
    Since:
      8.3