Copy File
Copies one file from `from` to `to`. If `to` points to an existing folder, the file is copied into that folder and keeps its current file name. If `to` does not point to an existing folder, it is interpreted as the full target file path. If `overwrite` is false, the block fails when the resulting target file path already exists. Missing parent folders are not created automatically. Use `createFolder` first when the destination folder does not exist. This block reads from `from` and writes to `to`, so both filesystem read and write permissions can matter.
Inputs
| Input | Required | Value Kind | Types | Enum Values |
|---|---|---|---|---|
from | yes | expression | string | — |
to | yes | expression | string | — |
overwrite | no | expression | — | — |
Notes
- Filesystem read/write statement that copies one file to another path.
- If
topoints to an existing folder, the source file is copied into that folder and keeps its original file name. - If
todoes not point to an existing folder, it is interpreted as the full target file path. - Fails on existing targets unless
overwrite=true. - Missing parent folders are not created automatically. Create them first with
createFolderwhen needed.
Examples
Copy File Into Created Folder
Builds a sibling destination folder and file path, creates the folder, then copies the file into it.
Topics: files, path handling
Source: patterns/ex-files-copy-into-created-folder.json