public event AsyncCompletedEventHandler RenameCompleted
Shows how to use RenameAsync method to asynchronously rename a file (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"); // ... // Rename remote file '/file.dat' to 'myfile.dat' await client.RenameAsync("/file.dat", "/myfile.dat"); // ... // Disconnect. client.Disconnect();
Shows how to use RenameAsync method to asynchronously rename a file.
using System; using System.ComponentModel; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... static void Main() { // Create a new class instance. Ftp client = new Ftp(); client.RenameCompleted += client_RenameCompleted; // Connect to the FTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Rename remote file '/file.dat' to 'myfile.dat' client.RenameAsync("/file.dat", "/myfile.dat"); // ... // Disconnect. client.Disconnect(); } static void client_RenameCompleted(object sender, AsyncCompletedEventArgs e) { // Ftp client = (Ftp)sender; if (e.Error != null) { Console.WriteLine("Error: " + e.Error.ToString()); } else Console.WriteLine("File renamed."); }
Shows how to use RenameAsync method to asynchronously rename a file (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"); // ... // Rename remote file '/file.dat' to 'myfile.dat' await client.RenameAsync("/file.dat", "/myfile.dat"); // ... // Disconnect. client.Disconnect();
Shows how to use RenameAsync method to asynchronously rename a file.
using System; using System.ComponentModel; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... static void Main() { // Create a new class instance. Sftp client = new Sftp(); client.RenameCompleted += client_RenameCompleted; // Connect to the SFTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Rename remote file '/file.dat' to 'myfile.dat' client.RenameAsync("/file.dat", "/myfile.dat"); // ... // Disconnect. client.Disconnect(); } static void client_RenameCompleted(object sender, AsyncCompletedEventArgs e) { // Sftp client = (Sftp)sender; if (e.Error != null) { Console.WriteLine("Error: " + e.Error.ToString()); } else Console.WriteLine("File renamed."); }