Skip to main content
Copies a file or directory to the path specified.

Required Parameters

  • source: The path of the file (including the filename) or directory to copy.
  • destination: The path of the file (including the filename) or directory where the file or directory is copied to.

Optional Parameters

  • force: Controls whether the operation creates missing directories in the destination path. The allowed values are true and false. The default is true. This is commonly used in conjunction with the recurse parameter when you need to mirror the directory structure of the source in the destination.
  • mask: The pattern used to select the entries to be copied. The default value is *. (For example, a mask of *.xml matches all xml files in the source.)
  • recurse: Recursively copy files and directories from the source. In this case the destination is assumed to be a directory. The allowed values are false and true. The default is false.

Output Attributes

  • file:source: The full path of the source file or directory.
  • file:destination: The full path of the destination file or directory.

Examples

Copy a Single File

Recursively Copy a Directory and its Contents

When this script is executed, the directory structure present in /tmp/foo is mirrored in /tmp/bar. Only .xml files are copied over from the source to the destination.