class aws_cdk.core.FileSystem

Bases: object

File system utilities.


# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.core as cdk

file_system = cdk.FileSystem()


tmpdir = '/tmp'

Static Methods

classmethod copy_directory(src_dir, dest_dir, options=None, root_dir=None)

Copies an entire directory structure.

  • src_dir (str) – Source directory.

  • dest_dir (str) – Destination directory.

  • options (Optional[CopyOptions]) – options.

  • root_dir (Optional[str]) – Root directory to calculate exclusions from.

Return type


classmethod fingerprint(file_or_directory, *, extra_hash=None, exclude=None, follow=None, ignore_mode=None)

Produces fingerprint based on the contents of a single file or an entire directory tree.

The fingerprint will also include:

  1. An extra string if defined in options.extra.

  2. The set of exclude patterns, if defined in options.exclude

  3. The symlink follow mode value.

  • file_or_directory (str) – The directory or file to fingerprint.

  • extra_hash (Optional[str]) – Extra information to encode into the fingerprint (e.g. build instructions and other inputs). Default: - hash is only based on source content

  • exclude (Optional[Sequence[str]]) – Glob patterns to exclude from the copy. Default: - nothing is excluded

  • follow (Optional[SymlinkFollowMode]) – A strategy for how to handle symlinks. Default: SymlinkFollowMode.NEVER

  • ignore_mode (Optional[IgnoreMode]) – The ignore behavior to use for exclude patterns. Default: IgnoreMode.GLOB

Return type


classmethod is_empty(dir)

Checks whether a directory is empty.


dir (str) – The directory to check.

Return type


classmethod mkdtemp(prefix)

Creates a unique temporary directory in the system temp directory.


prefix (str) – A prefix for the directory name. Six random characters will be generated and appended behind this prefix.

Return type