Skip to content

filesystem

Implements typical filesystem functionality, such as copying files and directories.

copy_dir

copy_dir(src_dir, dst_dir)

Copy a directory.

Recursively copy the specified directory to the specified destination directory.

Parameters:

Name Type Description Default
src_dir DirectoryTreeArtifact | str

The source directory. If str, src_dir can be an absolute path or a path relative to setting build.current_src_dir.

required
dst_dir DirectoryArtifact | str

The destination directory. If str, dst_dir must be a path relative to setting build.current_build_dir.

required

Example:

>>> some_string = 'hello'
>>> len(some_string)
5

copy_file

copy_file(src_file, dst_dir, new_file_name=None)

Copy a file.

Copy the specified file to the specified directory. The copy can be given a new name.

Parameters:

Name Type Description Default
src_file FileArtifact | str

Source file path (absolute, or relative to setting build.current_src_dir).

required
dst_dir DirectoryArtifact | StringArtifact | str

Destination directory path (absolute, or relative to setting build.current_build_dir).

required
new_file_name str | None

(Optional) New name for the copied file.

None

make_directory

make_directory(rel_path)

Make a directory, and any necessary non-existent parent directories.

Parameters:

Name Type Description Default
rel_path str

The path of the directory to be created, relative to the current build directory.

required