MCPcopy Create free account
hub / github.com/dbt-labs/ade-bench / copy_item

Function copy_item

scripts_python/create_sandbox.py:74–102  ·  view source on GitHub ↗

Generic function to copy files or directories.

(source_path, dest_path, item_name, create_dest_dir=False)

Source from the content-addressed store, hash-verified

72
73
74def copy_item(source_path, dest_path, item_name, create_dest_dir=False):
75 """Generic function to copy files or directories."""
76 if not source_path.exists():
77 print(f"Warning: {item_name} not found at {source_path}")
78 return True
79
80 try:
81 if create_dest_dir:
82 dest_path.mkdir(parents=True, exist_ok=True)
83
84 if source_path.is_file():
85 shutil.copy2(source_path, dest_path)
86 elif source_path.is_dir():
87 if dest_path.exists():
88 # Copy contents into existing directory
89 for item in source_path.iterdir():
90 if item.is_file():
91 shutil.copy2(item, dest_path)
92 elif item.is_dir():
93 shutil.copytree(item, dest_path / item.name)
94 else:
95 # Copy entire directory
96 shutil.copytree(source_path, dest_path)
97
98 print(f"✓ Copied {item_name} to sandbox")
99 return True
100 except Exception as e:
101 print(f"Error copying {item_name}: {e}")
102 return False
103
104
105def copy_project_contents(task_name, variant):

Callers 5

copy_project_contentsFunction · 0.85
copy_database_fileFunction · 0.85
copy_task_filesFunction · 0.85
copy_migration_filesFunction · 0.85
copy_shared_scriptsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected