MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / merge_directory

Function merge_directory

tasks/scripts/sync_docs_website.py:102–117  ·  view source on GitHub ↗
(src: Path, dst: Path, *, overwrite: bool)

Source from the content-addressed store, hash-verified

100
101
102def merge_directory(src: Path, dst: Path, *, overwrite: bool) -> None:
103 if not src.exists():
104 return
105 if overwrite:
106 shutil.copytree(src, dst, dirs_exist_ok=True)
107 return
108 for copied in src.rglob("*"):
109 relative = copied.relative_to(src)
110 target = dst / relative
111 if copied.is_dir():
112 target.mkdir(parents=True, exist_ok=True)
113 continue
114 if target.exists():
115 continue
116 target.parent.mkdir(parents=True, exist_ok=True)
117 shutil.copy2(copied, target)
118
119
120def copy_if_exists(src: Path, dst: Path) -> None:

Callers 1

sync_docsFunction · 0.85

Calls 1

existsMethod · 0.80

Tested by

no test coverage detected