public event ExtendedAsyncCompletedEventHandler<TResult> DeleteCompleted
Shows how to use DeleteAsync method to asynchronously delete .tmp file in a directory (Task-based approach).
using System; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... // Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Delete *.tmp remote files in '/Temp Folder'. await client.DeleteAsync("/Temp Folder/*.tmp", true); // ... // Disconnect. client.Disconnect();
Shows how to use DeleteAsync method to asynchronously delete .tmp file in a directory (Event-based approach).
using System; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... static void Main() { // Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Register an event handler. client.DeleteCompleted += client_DeleteCompleted; // Delete *.tmp remote files in '/Temp Folder'. client.DeleteAsync("/Temp Folder/*.tmp", true); // ... // Disconnect. client.Disconnect(); } static void client_DeleteCompleted(object sender, ExtendedAsyncCompletedEventArgs<FileSystemTransferStatistics> e) { // Ftp client = (Ftp)sender; if (e.Error != null) Console.WriteLine("Error: " + e.Error.Message); else { Console.WriteLine("Files deleted: " + e.Result.FilesProcessed); } }
Shows how to use DeleteAsync method to asynchronously delete .tmp file in a directory (Task-based approach).
using System; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... // Create a new class instance. Sftp client = new Sftp(); // Connect to the SFTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Delete *.tmp remote files in '/Temp Folder'. await client.DeleteAsync("/Temp Folder/*.tmp", true); // ... // Disconnect. client.Disconnect();
Shows how to use DeleteAsync method to asynchronously delete .tmp file in a directory (Event-based approach).
using System; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... static void Main() { // Create a new class instance. Sftp client = new Sftp(); // Connect to the SFTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Register an event handler. client.DeleteCompleted += client_DeleteCompleted; // Delete *.tmp remote files in '/Temp Folder'. client.DeleteAsync("/Temp Folder/*.tmp", true); // ... // Disconnect. client.Disconnect(); } static void client_DeleteCompleted(object sender, ExtendedAsyncCompletedEventArgs<FileSystemTransferStatistics> e) { // Sftp client = (Sftp)sender; if (e.Error != null) Console.WriteLine("Error: " + e.Error.Message); else { Console.WriteLine("Files deleted: " + e.Result.FilesProcessed); } }