GetFileSize.cs 506 B

12345678910111213141516
  1. using System;
  2. using System.Net;
  3. using System.Net.FtpClient;
  4. namespace Examples {
  5. static class GetFileSizeExample {
  6. public static void GetFileSize() {
  7. using (FtpClient conn = new FtpClient()) {
  8. conn.Host = "localhost";
  9. conn.Credentials = new NetworkCredential("ftptest", "ftptest");
  10. Console.WriteLine("The file size is: {0}",
  11. conn.GetFileSize("/full/or/relative/path/to/file"));
  12. }
  13. }
  14. }
  15. }