kedro/framework/cli/pipeline.py
def _sync_dirs(source: Path, target: Path, prefix: str = ""):
    """Recursively copies `source` directory into `target` directory without
    overwriting any existing files/directories in the target using the following
    rules:
        1) Skip any files/directories from source have same names as files in target.
        2) Copy all files from source to target.
        3) Recursively copy all directories from source to target.

    Args:
        source: A local directory to copy from, must exist.
        target: A local directory to copy to, will be created if doesn't exist yet.
        prefix: Prefix for CLI message indentation.
    """

    existing = list(target.iterdir()) if target.is_dir() else []
    existing_files = {f.name for f in existing if f.is_file()}
    existing_folders = {f.name for f in existing if f.is_dir()}

    for source_path in source.iterdir():
        source_name = source_path.name
        target_path = target / source_name
        click.echo(indent(f"Creating `{target_path}`: ", prefix), nl=False)

        if (  # rule #1
            source_name in existing_files
            or source_path.is_file()
            and source_name in existing_folders
        ):
            click.secho("SKIPPED (already exists)", fg="yellow")
        elif source_path.is_file():  # rule #2
            try:
                target.mkdir(exist_ok=True, parents=True)
                shutil.copyfile(str(source_path), str(target_path))
            except Exception:
                click.secho("FAILED", fg="red")
                raise
            click.secho("OK", fg="green")
        else:  # source_path is a directory, rule #3
            click.echo()
            double_prefix = (prefix or " ") * 2
            _sync_dirs(source_path, target_path, prefix=double_prefix)
Recursively copies `source` directory into `target` directory without
    overwriting any existing files/directories in the target using the following
    rules:
        1) Skip any files/directories from source have same names as files in target.
        2) Copy all files from source to target.
        3) Recursively copy all directories from source to target.

    Args:
        source: A local directory to copy from, must exist.
        target: A local directory to copy to, will be created if doesn't exist yet.
        prefix: Prefix for CLI message indentation.
    
Recursively copies `source` directory into `target` directory without
overwriting any existing files/directories in the target using the following
rules:
1) Skip any files/directories from source have same names as files in target.
2) Copy all files from source to target.
3) Recursively copy all directories from source to target.
Recursively copies ` source ` directory into ` target ` directory without overwriting any existing files / directories in the target using the following rules : 1 ) Skip any files / directories from source have same names as files in target . 2 ) Copy all files from source to target . 3 ) Recursively copy all directories from source to target .
def _sync_dirs(source: Path, target: Path, prefix: str = ""):
    existing = list(target.iterdir()) if target.is_dir() else []
    existing_files = {f.name for f in existing if f.is_file()}
    existing_folders = {f.name for f in existing if f.is_dir()}
    for source_path in source.iterdir():
        source_name = source_path.name
        target_path = target / source_name
        click.echo(indent(f"Creating `{target_path}`: ", prefix), nl=False)
        if (  
            source_name in existing_files
            or source_path.is_file()
            and source_name in existing_folders
        ):
            click.secho("SKIPPED (already exists)", fg="yellow")
        elif source_path.is_file():  
            try:
                target.mkdir(exist_ok=True, parents=True)
                shutil.copyfile(str(source_path), str(target_path))
            except Exception:
                click.secho("FAILED", fg="red")
                raise
            click.secho("OK", fg="green")
        else:  
            click.echo()
            double_prefix = (prefix or " ") * 2
            _sync_dirs(source_path, target_path, prefix=double_prefix)
def _sync_dirs ( source : Path , target : Path , prefix : str = "" ) : existing = list ( target . iterdir ( ) ) if target . is_dir ( ) else [ ] existing_files = { f . name for f in existing if f . is_file ( ) } existing_folders = { f . name for f in existing if f . is_dir ( ) } for source_path in source . iterdir ( ) : source_name = source_path . name target_path = target / source_name click . echo ( indent ( f"Creating `{target_path}`: " , prefix ) , nl = False ) if ( source_name in existing_files or source_path . is_file ( ) and source_name in existing_folders ) : click . secho ( "SKIPPED (already exists)" , fg = "yellow" ) elif source_path . is_file ( ) : try : target . mkdir ( exist_ok = True , parents = True ) shutil . copyfile ( str ( source_path ) , str ( target_path ) ) except Exception : click . secho ( "FAILED" , fg = "red" ) raise click . secho ( "OK" , fg = "green" ) else : click . echo ( ) double_prefix = ( prefix or " " ) * 2 _sync_dirs ( source_path , target_path , prefix = double_prefix )
Recursively copies `source` directory into `target` directory without
overwriting any existing files/directories in the target using the following
rules:
1) Skip any files/directories from source have same names as files in target.
Recursively copies ` source ` directory into ` target ` directory without overwriting any existing files / directories in the target using the following rules : 1 ) Skip any files / directories from source have same names as files in target .
"""Recursively copies `source` directory into `target` directory without
    overwriting any existing files/directories in the target using the following
    rules:
        1) Skip any files/directories from source have same names as files in target.
        2) Copy all files from source to target.
        3) Recursively copy all directories from source to target.

    Args:
        source: A local directory to copy from, must exist.
        target: A local directory to copy to, will be created if doesn't exist yet.
        prefix: Prefix for CLI message indentation.
    """ # rule #1 # rule #2 # source_path is a directory, rule #3
source
Path
A local directory to copy from, must exist.
A local directory to copy from must exist .
target
Path
A local directory to copy to, will be created if doesn't exist yet.
A local directory to copy to will be created if doesn ' t exist yet .
prefix
str
Prefix for CLI message indentation.
Prefix for CLI message indentation .