Skip to content

FTPClient » Rename

Renames a remote file on the ftp server. Returns true if renaming was successful or false otherwise.

js
client.Rename(oldPath, newPath);

Parameters

  • oldPath - The remote path to rename.
  • newPath - The new remote path.

Example

js
let client = ftp.Connect(
    "sftp", 
    "example.domain.com", 
    22,
    "brad",
    "password"
);

if (client.IsConnected()) {
    let result = client.Rename('/remote/path/README.md', '/remote/path/README2.md');
    console.log("Renaming file result: " + result);
}