FileSystem

class aws_cdk.core.FileSystem

Bases: object

File system utilities.

__init__()

Initialize self. See help(type(self)) for accurate signature.

Return type

None

Attributes

tmpdir = '/tmp'

Static Methods

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

Copies an entire directory structure.

Parameters
  • 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

None

classmethod fingerprint(file_or_directory, *, extra_hash=None, exclude=None, follow=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.

Parameters
  • 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[List[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

Return type

str

classmethod is_empty(dir)

Checks whether a directory is empty.

Parameters

dir (str) – The directory to check.

Return type

bool

classmethod mkdtemp(prefix)

Creates a unique temporary directory in the system temp directory.

Parameters

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

Return type

str