DirectoryExists.cs 525 B

1234567891011121314151617181920
  1. using System;
  2. using System.Net;
  3. using System.Net.FtpClient;
  4. namespace Examples {
  5. static class DirectoryExistsExample {
  6. public static void DeleteDirectory() {
  7. using (FtpClient conn = new FtpClient()) {
  8. conn.Host = "localhost";
  9. conn.Credentials = new NetworkCredential("ftptest", "ftptest");
  10. if (conn.DirectoryExists("/full/or/relative/path")) {
  11. // do something
  12. }
  13. }
  14. }
  15. }
  16. }