A FileSystemTransferStatistics instance returned from a multi-file operation method can be used to show the number of files and directories transferred, bytes per second, etc. The following example shows how to do so.
using System; using ComponentPro.Net; using ComponentPro.IO; ... // Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("localhost"); // Authenticate. client.Authenticate("test", "test"); // ... // Upload all files and subdirectories from local folder 'c:\temp' to the remote dir '/temp' FileSystemTransferStatistics statistics = client.Upload("c:\\temp", "/temp"); // Show statistics Console.WriteLine("Total files transferred: " + statistics.FilesProcessed); Console.WriteLine("Total directories transferred: " + statistics.DirectoriesProcessed); Console.WriteLine("Total bytes transferred: " + statistics.TotalBytesTransferred); // ... // Disconnect. client.Disconnect();
A FileSystemTransferStatistics instance returned from a multi-file operation method can be used to show the number of files and directories transferred, bytes per second, etc. The following example shows how to do so.
using System; using ComponentPro.Net; using ComponentPro.IO; ... // Create a new class instance. Sftp client = new Sftp(); // Connect to the SFTP server. client.Connect("localhost"); // Authenticate. client.Authenticate("test", "test"); // ... // Upload all files and subdirectories from local folder 'c:\temp' to the remote dir '/temp' FileSystemTransferStatistics statistics = client.Upload("c:\\temp", "/temp"); // Show statistics Console.WriteLine("Total files transferred: " + statistics.FilesProcessed); Console.WriteLine("Total directories transferred: " + statistics.DirectoriesProcessed); Console.WriteLine("Total bytes transferred: " + statistics.TotalBytesTransferred); // ... // Disconnect. client.Disconnect();
Show transfer statistics after a call to AddFiles method.
using System; using ComponentPro.Compression; using ComponentPro.IO; ... // Create a new instance of Zip class. Zip zip = new Zip(); // Create a new archive. zip.Create("test.zip"); // ... // Add all files and subdirectories from local folder 'c:\temp' to the archive dir '/my dir' FileSystemTransferStatistics transferStatistics = zip.AddFiles("c:\\temp", "/my dir"); // Show statistics Console.WriteLine("Total files transferred: " + transferStatistics.FilesProcessed); Console.WriteLine("Total bytes transferred: " + transferStatistics.TotalBytesTransferred); // ... // Close. zip.Close();