FileSystem

class aws_cdk.FileSystem

Bases: object

File system utilities.

ExampleMetadata:

fixture=_generated

Example:

# 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_system = cdk.FileSystem()

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 (Union[CopyOptions, Dict[str, Any], None]) – 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, ignore_mode=None)

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

Line endings are converted from CRLF to LF.

The fingerprint will also include:

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

  2. 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[Sequence[str]]) – File paths matching the patterns will be excluded. See ignoreMode to set the matching behavior. Has no effect on Assets bundled using the bundling property. 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:

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