Skip to main content

Copy File

Category: Files Copy File block screenshot

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

InputRequiredValue KindTypesEnum Values
fromyesexpressionstring
toyesexpressionstring
overwritenoexpression

Notes

  • Filesystem read/write statement that copies one file to another path.
  • If to points to an existing folder, the source file is copied into that folder and keeps its original file name.
  • If to does 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 createFolder when needed.

Examples

Copy File Into Created Folder

Builds a sibling destination folder and file path, creates the folder, then copies the file into it.

kind: Pattern · format: runtime-dsl · validation: Schema only

Topics: files, path handling

Source: patterns/ex-files-copy-into-created-folder.json

Download JSON