# SyncSpec

interface SyncSpec : CopySpec(source)

Synchronizes the contents of a destination directory with some source directories and files.

#### Since

7.5

## Functions

dirPermissions
Link copied to clipboard
abstract fun dirPermissions(configureAction: Action<in ConfigurableFilePermissions>): CopyProcessingSpec
Configuration action for specifying directory access permissions.
eachFile
Link copied to clipboard
abstract fun eachFile(@DelegatesTo(value = FileCopyDetails::class, strategy = Closure.DELEGATE_FIRST) closure: Closure): CopyProcessingSpec
abstract fun eachFile(@DelegatesTo(value = FileCopyDetails::class) closure: Closure): CopySpec
Adds an action to be applied to each file as it about to be copied into its destination.
abstract fun eachFile(action: Action<in FileCopyDetails>): CopyProcessingSpec
abstract fun eachFile(action: Action<in FileCopyDetails>): CopySpec
Adds an action to be applied to each file as it is about to be copied into its destination.
exclude
Link copied to clipboard
abstract fun exclude(excludeSpec: Closure): CopySpec
abstract fun exclude(excludeSpec: Spec<FileTreeElement>): CopySpec
abstract fun exclude(excludeSpec: Closure): PatternFilterable
abstract fun exclude(excludeSpec: Spec<FileTreeElement>): PatternFilterable
Adds an exclude spec.
abstract fun exclude(excludes: Iterable<String>): CopySpec
abstract fun exclude(excludes: Array<String>): CopySpec
abstract fun exclude(excludes: Iterable<String>): PatternFilterable
abstract fun exclude(excludes: Array<String>): PatternFilterable
Adds an ANT style exclude pattern.
expand
Link copied to clipboard
abstract fun expand(properties: Map<String, out Any>): ContentFilterable
abstract fun expand(properties: Map<String, out Any>, action: Action<in ExpandDetails>): ContentFilterable
abstract fun expand(properties: Map<String, out Any>): CopySpec
abstract fun expand(properties: Map<String, out Any>, action: Action<in ExpandDetails>): CopySpec
Expands property references in each file as it is copied.
filePermissions
Link copied to clipboard
abstract fun filePermissions(configureAction: Action<in ConfigurableFilePermissions>): CopyProcessingSpec
Configuration action for specifying file access permissions.
filesMatching
Link copied to clipboard
abstract fun filesMatching(patterns: Iterable<String>, action: Action<in FileCopyDetails>): CopySpec
Configure the org.gradle.api.file.FileCopyDetails for each file whose path matches any of the specified Ant-style patterns.
abstract fun filesMatching(pattern: String, action: Action<in FileCopyDetails>): CopySpec
Configure the org.gradle.api.file.FileCopyDetails for each file whose path matches the specified Ant-style pattern.
filesNotMatching
Link copied to clipboard
abstract fun filesNotMatching(patterns: Iterable<String>, action: Action<in FileCopyDetails>): CopySpec
Configure the org.gradle.api.file.FileCopyDetails for each file whose path does not match any of the specified Ant-style patterns.
abstract fun filesNotMatching(pattern: String, action: Action<in FileCopyDetails>): CopySpec
Configure the org.gradle.api.file.FileCopyDetails for each file whose path does not match the specified Ant-style pattern.
filter
Link copied to clipboard
abstract fun filter(closure: Closure): ContentFilterable
abstract fun filter(closure: Closure): CopySpec
Adds a content filter based on the provided closure.
abstract fun filter(filterType: Class<out FilterReader>): ContentFilterable
abstract fun filter(properties: Map<String, out Any>, filterType: Class<out FilterReader>): ContentFilterable
abstract fun filter(filterType: Class<out FilterReader>): CopySpec
abstract fun filter(properties: Map<String, out Any>, filterType: Class<out FilterReader>): CopySpec
Adds a content filter to be used during the copy.
abstract fun filter(transformer: Transformer<@Nullable String, String>): ContentFilterable
abstract fun filter(transformer: Transformer<@Nullable String, String>): CopySpec
Adds a content filter based on the provided transformer.
from
Link copied to clipboard
abstract fun from(@Nullable sourcePaths: Array<@Nullable Any>): CopySourceSpec
abstract fun from(@Nullable sourcePaths: Array<@Nullable Any>): CopySpec
Specifies source files or directories for a copy.
abstract fun from(sourcePath: Any, @DelegatesTo(value = CopySpec::class) configureClosure: Closure): CopySourceSpec
Specifies the source files or directories for a copy and creates a child `CopySourceSpec`.
abstract fun from(sourcePath: Any, configureAction: Action<in CopySpec>): CopySourceSpec
Specifies the source files or directories for a copy and creates a child `CopySpec`.
abstract fun from(sourcePath: Any, @DelegatesTo(value = CopySpec::class) c: Closure): CopySpec
Specifies the source files or directories for a copy and creates a child CopySourceSpec}.
abstract fun from(sourcePath: Any, configureAction: Action<in CopySpec>): CopySpec
Specifies the source files or directories for a copy and creates a child CopySpec}.
getDirPermissions
Link copied to clipboard
abstract fun getDirPermissions(): Property<ConfigurableFilePermissions>
Property for querying and configuring directory access permissions.
getDuplicatesStrategy
Link copied to clipboard
abstract fun getDuplicatesStrategy(): DuplicatesStrategy
Returns the strategy to use when trying to copy more than one file to the same destination.
getExcludes
Link copied to clipboard
abstract fun getExcludes(): Set<String>
Returns the set of exclude patterns.
getFilePermissions
Link copied to clipboard
abstract fun getFilePermissions(): Property<ConfigurableFilePermissions>
Property for querying and configuring file access permissions.
getFilteringCharset
Link copied to clipboard
abstract fun getFilteringCharset(): String
Gets the charset used to read and write files when filtering.
getIncludeEmptyDirs
Link copied to clipboard
abstract fun getIncludeEmptyDirs(): Boolean
Tells if empty target directories will be included in the copy.
getIncludes
Link copied to clipboard
abstract fun getIncludes(): Set<String>
Returns the set of include patterns.
getPreserve
Link copied to clipboard
@Internal
abstract fun getPreserve(): PatternFilterable
Returns the filter that defines which files to preserve in the destination directory.
include
Link copied to clipboard
abstract fun include(includeSpec: Closure): CopySpec
abstract fun include(includeSpec: Spec<FileTreeElement>): CopySpec
abstract fun include(includeSpec: Closure): PatternFilterable
abstract fun include(includeSpec: Spec<FileTreeElement>): PatternFilterable
Adds an include spec.
abstract fun include(includes: Iterable<String>): CopySpec
abstract fun include(includes: Array<String>): CopySpec
abstract fun include(includes: Iterable<String>): PatternFilterable
abstract fun include(includes: Array<String>): PatternFilterable
Adds an ANT style include pattern.
into
Link copied to clipboard
abstract fun into(destPath: Any): CopyProcessingSpec
abstract fun into(destPath: Any): CopySpec
Specifies the destination directory for a copy.
abstract fun into(destPath: Any, @DelegatesTo(value = CopySpec::class) configureClosure: Closure): CopySpec
abstract fun into(destPath: Any, copySpec: Action<in CopySpec>): CopySpec
Creates and configures a child `CopySpec` with the given destination path.
isCaseSensitive
Link copied to clipboard
abstract fun isCaseSensitive(): Boolean
Specifies whether case-sensitive pattern matching should be used.
preserve
Link copied to clipboard
abstract fun preserve(action: Action<in PatternFilterable>): SyncSpec
Configures the filter that defines which files to preserve in the destination directory.
rename
Link copied to clipboard
abstract fun rename(closure: Closure): CopyProcessingSpec
abstract fun rename(renamer: Transformer<@Nullable String, String>): CopyProcessingSpec
abstract fun rename(closure: Closure): CopySpec
abstract fun rename(renamer: Transformer<@Nullable String, String>): CopySpec
Renames a source file.
abstract fun rename(sourceRegEx: String, replaceWith: String): CopyProcessingSpec
abstract fun rename(sourceRegEx: String, replaceWith: String): CopySpec
abstract fun rename(sourceRegEx: Pattern, replaceWith: String): CopyProcessingSpec
Renames files based on a regular expression.
setCaseSensitive
Link copied to clipboard
abstract fun setCaseSensitive(caseSensitive: Boolean)
Specifies whether case-sensitive pattern matching should be used for this CopySpec.
setDuplicatesStrategy
Link copied to clipboard
abstract fun setDuplicatesStrategy(strategy: DuplicatesStrategy)
The strategy to use when trying to copy more than one file to the same destination.
setExcludes
Link copied to clipboard
abstract fun setExcludes(excludes: Iterable<String>): CopySpec
abstract fun setExcludes(excludes: Iterable<String>): PatternFilterable
Set the allowable exclude patterns.
setFilteringCharset
Link copied to clipboard
abstract fun setFilteringCharset(charset: String)
Specifies the charset used to read and write files when filtering.
setIncludeEmptyDirs
Link copied to clipboard
abstract fun setIncludeEmptyDirs(includeEmptyDirs: Boolean)
Controls if empty target directories should be included in the copy.
setIncludes
Link copied to clipboard
abstract fun setIncludes(includes: Iterable<String>): CopySpec
abstract fun setIncludes(includes: Iterable<String>): PatternFilterable
Set the allowable include patterns.
with
Link copied to clipboard
abstract fun with(sourceSpecs: Array<CopySpec>): CopySpec
Adds the given specs as a child of this spec.