.NET Core C#
.NET Core C#
Delete Remote File
See more FTP Examples
Delete a remote file.Chilkat .NET Core C# Downloads
bool success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Chilkat.Ftp2 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) {
Debug.WriteLine(ftp.LastErrorText);
return;
}
// Set the current remote directory to where the file
// is located:
success = ftp.ChangeRemoteDir("/testing");
if (success != true) {
Debug.WriteLine(ftp.LastErrorText);
return;
}
success = ftp.DeleteRemoteFile("goodbye.txt");
if (success != true) {
Debug.WriteLine(ftp.LastErrorText);
return;
}
success = ftp.Disconnect();