public event ExtendedAsyncCompletedEventHandler<TResult> MoveCompleted
Shows how to use MoveAsync method to asynchronously move files on an FTP server (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.MoveCompleted += client_MoveCompleted; // Get all files and subdirectories that match the specified search pattern in remote folder '/myfolder2' to another remote folder '/myfolder2'. client.MoveAsync("/myfolder2", "/myfolder2", "*.cs"); // ... // Disconnect. client.Disconnect(); } static void client_MoveCompleted(object sender, ExtendedAsyncCompletedEventArgs<FileSystemTransferStatistics> e) { // Ftp client = (Ftp)sender; if (e.Error != null) Console.WriteLine("Error: " + e.Error.ToString()); else { Console.WriteLine("Uploaded files: " + e.Result.FilesProcessed); } }
Shows how to use MoveAsync method to asynchronously move files on an SFTP server (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.MoveCompleted += client_MoveCompleted; // Get all files and subdirectories that match the specified search pattern in remote folder '/myfolder2' to another remote folder '/myfolder2'. client.MoveAsync("/myfolder2", "/myfolder2", "*.cs"); // ... // Disconnect. client.Disconnect(); } static void client_MoveCompleted(object sender, ExtendedAsyncCompletedEventArgs<FileSystemTransferStatistics> e) { // Sftp client = (Sftp)sender; if (e.Error != null) Console.WriteLine("Error: " + e.Error.ToString()); else { Console.WriteLine("Uploaded files: " + e.Result.FilesProcessed); } }