Node.js
Node.js
Delete Remote File
See more FTP Examples
Delete a remote file.Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var ftp = new chilkat.Ftp2();
ftp.Hostname = "ftp.chilkatsoft.com";
ftp.Username = "myLogin";
ftp.Password = "myPassword";
// Connect and login to the FTP server.
success = ftp.Connect();
if (success !== true) {
console.log(ftp.LastErrorText);
return;
}
// Set the current remote directory to where the file
// is located:
success = ftp.ChangeRemoteDir("/testing");
if (success !== true) {
console.log(ftp.LastErrorText);
return;
}
success = ftp.DeleteRemoteFile("goodbye.txt");
if (success !== true) {
console.log(ftp.LastErrorText);
return;
}
success = ftp.Disconnect();
}
chilkatExample();