MCPcopy Create free account
hub / github.com/ResearAI/AutoFigure / copy_file

Function copy_file

autofigure/utils/file_utils.py:88–107  ·  view source on GitHub ↗

Copy a file from source to destination. Args: src: Source file path dst: Destination file path Returns: True on success, False on failure

(src: Union[str, Path], dst: Union[str, Path])

Source from the content-addressed store, hash-verified

86
87
88def copy_file(src: Union[str, Path], dst: Union[str, Path]) -> bool:
89 """
90 Copy a file from source to destination.
91
92 Args:
93 src: Source file path
94 dst: Destination file path
95
96 Returns:
97 True on success, False on failure
98 """
99 try:
100 import shutil
101 dst = Path(dst)
102 dst.parent.mkdir(parents=True, exist_ok=True)
103 shutil.copy2(src, dst)
104 return True
105 except Exception as e:
106 print(f"[file_utils] Failed to copy {src} to {dst}: {e}")
107 return False
108
109
110def get_file_extension(path: Union[str, Path]) -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected