<file:copy sourcePath="source.txt"
targetPath="backup"
overwrite="true|false"
createParentDirectories="true|false"
renameTo="renamed.txt"/>
<file:move sourcePath="source.txt"
targetPath="backup"
overwrite="true|false"
createParentDirectories="true|false"
renameTo="renamed.txt"/>
Copy and Move Files - Mule 4
The File connector can copy or move files or directories on demand. If you specify the sourcePath
as a directory name,
a directory is copied or moved. Otherwise if sourcePath
is a file, only the file is copied or moved.
If a file or directory already exists and overwrite
is false
, the FILE:FILE_ALREADY_EXISTS
error occurs.
Notice the targetPath
and renameTo
parameters:
-
targetPath
- The name of a directory into which the file is to be copied or moved. This path must point to a directory. IftargetPath
doesn’t exist, and neither does its parent, an attempt is made to create depending on the value of thecreateParentDirectories
argument. IfcreateParentDirectories
isfalse
, thenFILE:ILLEGAL_PATH
occurs. -
renameTo
- An optional parameter that renames the file as part of the operation. This parameter must be a file name, not a path. If this attribute is not provided, the original file name is retained.