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])
| 86 | |
| 87 | |
| 88 | def 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 | |
| 110 | def get_file_extension(path: Union[str, Path]) -> str: |
nothing calls this directly
no outgoing calls
no test coverage detected