Skip to content
v2.278.0

FileCopyOptions Struct ​

Options applied when copying directories into the staging location.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const fileCopyOptions: cdk.FileCopyOptions = {
  exclude: ['exclude'],
  followSymlinks: cdk.SymlinkFollowMode.NEVER,
  ignoreMode: cdk.IgnoreMode.GLOB,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

file_copy_options = cdk.FileCopyOptions(
    exclude=["exclude"],
    follow_symlinks=cdk.SymlinkFollowMode.NEVER,
    ignore_mode=cdk.IgnoreMode.GLOB
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;

FileCopyOptions fileCopyOptions = FileCopyOptions.builder()
        .exclude(List.of("exclude"))
        .followSymlinks(SymlinkFollowMode.NEVER)
        .ignoreMode(IgnoreMode.GLOB)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;

var fileCopyOptions = new FileCopyOptions {
    Exclude = new [] { "exclude" },
    FollowSymlinks = SymlinkFollowMode.NEVER,
    IgnoreMode = IgnoreMode.GLOB
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

fileCopyOptions := &FileCopyOptions{
	Exclude: []*string{
		jsii.String("exclude"),
	},
	FollowSymlinks: cdk.SymlinkFollowMode_NEVER,
	IgnoreMode: cdk.IgnoreMode_GLOB,
}

Properties ​

excludeoptionalstring[]excludeoptionaltyping.List[str]excludeoptionalList<String>Excludeoptionalstring[]Excludeoptional*[]*string #
File paths matching the patterns will be excluded. See `ignoreMode` to set the matching behavior.

Default: nothing is excluded

notes

Without bundling ​

When used without the bundling property, the asset is just a regular file copy operation. In that case, this controls the files that will be included in the copy. Files matching the exclude patterns will not be included in the copy.

With bundling ​

When used with the bundling property, the asset is produced by a bundling operation. In that case, the value of exclude is only meaningful if the assetHashType is set to AssetHashType.SOURCE, and ignored for other asset hash types. The exclude patterns will be used to determine which files contribute to the asset, and the bundling command is skipped if the source files have not changed since the last bundling operation.

NOTE: The bundling operation still has access to all files in the source path, regardless of the exclude patterns. It is your responsibility to ensure the exclude pattern accurately matches the files the bundling operation will actually access and base its final output on.

For OUTPUT or CUSTOM asset hash types, the exclude pattern is ignored.

ignoreModeoptionalIgnoreModeignore_modeoptionalIgnoreModeignoreModeoptionalIgnoreModeIgnoreModeoptionalIgnoreModeIgnoreModeoptionalIgnoreMode #
What syntax the `exclude` patterns are written in.

Default: IgnoreMode.GLOB for file assets, IgnoreMode.DOCKER for image assets (requires that the @aws-cdk/aws-ecr-assets:dockerIgnoreSupport feature flag is set, which is recommended)