copy_file
Copy a file to a new path while preserving permissions, creating missing parent directories, and refusing overwrite unless explicitly allowed.
Instructions
Copy a file to a new path, preserving file permissions. Parent directories of to are created if missing. Refuses to overwrite an existing destination unless overwrite=true. Cross-device copies are supported. Notifies the LSP server with FileCreated so diagnostics update immediately. The response shows the diff of what landed at the destination — every line added, plus the destination it replaced when overwrite=true — gated by [edits].show_write_diff. To move or rename a file, use rename_file instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Absolute path, file:// URI, or workspace-relative path of the destination. Parent directories are created automatically. | |
| from | No | Absolute path, file:// URI, or workspace-relative path of the source file. | |
| dirty_ok | No | Allow copying a file that has uncommitted changes. Default false. | |
| overwrite | No | Allow overwriting an existing destination file. Default false. |