Skip to content

SFTP Move / Rename

Type: sftp-move  ·  Package: SFTP Activities v1.1.0  ·  Output: string

Moves or renames a file on the SFTP server. Widely used to archive what was processed: after downloading a file, move it to a /processed folder on the server so it is not picked up again.

Renames sourcePath to destinationPath (both remote paths, with the file name). If both are in the same folder with different names, it is a rename; if the folder changes, a move. The operation happens on the server, without transferring the content.

  • The destination folder must exist.
  • If a file already exists at destinationPath, most servers reject the change: delete or rename the existing one first, or use a unique name (for example with the date).
ParameterTypeDefaultDescription
sourcePathstring—Remote source path.
destinationPathstring—Remote destination path, with the file name.
ParameterTypeDefaultDescription
sessionZoanSftpSession—Session from SFTP Connect. Inherited inside a body.

Returns a string with the new remote path of the file (the same value as destinationPath). Since version 1.1.0 the Designer offers it as an output.

MessageCause and fix
'sourcePath' is required. / 'destinationPath' is required.The parameter is missing or the expression returned null.
'session' must be a ZoanSftpSession.The activity is outside the SFTP Connect body and received no session.
Server error: file not foundsourcePath does not exist (maybe it was already moved in a previous run). Check it with SFTP Exists.
Server error when renamingThe destination already exists, its folder does not exist, or the user has no write permission.

Archive on the server after downloading, with the date in the name to avoid clashing with earlier files:

SFTP Download remotePath = "/outbound/data.csv" localPath = "C:/downloads/data.csv"
SFTP Move / Rename sourcePath = "/outbound/data.csv" destinationPath = "/outbound/processed/data_" + now().ToString("yyyyMMdd-HHmmss") + ".csv"