Copy and Move Files with the SFTP Connector - Mule 4
The connector also provides the ability to copy and move files or directories on demand.
<sftp:copy sourcePath="source.txt" targetPath="backup" overwrite="true|false" createParentDirectories="true|false" renameTo="renamed.txt"/> <sftp:move sourcePath="source.txt" targetPath="backup" overwrite="true|false" createParentDirectories="true|false" renameTo="renamed.txt"/>
targetPathis the path to the directory into which the file is to be copied or moved. This path must point to a directory.
renameTois 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.
While SFTP has a native concept of copying and moving, FTP does not. The FTP connector simulates these operations by downloading file content and writing it to a new location. Although all of this is done with concurrent streams that start writing at the same time as it starts reading, copying and moving does have a significant network overhead and should be used wisely.
The SFTP Move operation does not impact network overhead.
This operation simply creates a directory of a given name. If the reason for creating the directory is to immediately after write, copy or move contents to it, then use the write, copy, or move operations with the
For a complete description of the parameters, return type and errors, see the SFTP Create Directory Operation.