12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System;
- using System.Net;
- using System.Net.FtpClient;
- namespace Examples {
- static class GetListingExample {
- public static void GetListing() {
- using (FtpClient conn = new FtpClient()) {
- conn.Host = "localhost";
- conn.Credentials = new NetworkCredential("ftptest", "ftptest");
-
- foreach (FtpListItem item in conn.GetListing(conn.GetWorkingDirectory(),
- FtpListOption.Modify | FtpListOption.Size)) {
- switch (item.Type) {
- case FtpFileSystemObjectType.Directory:
- break;
- case FtpFileSystemObjectType.File:
- break;
- case FtpFileSystemObjectType.Link:
-
- if (item.LinkTarget != null) {
-
-
- item.LinkObject = conn.DereferenceLink(item);
- if (item.LinkObject != null) {
-
- }
- }
- break;
- }
- }
-
-
- foreach (FtpListItem item in conn.GetListing(conn.GetWorkingDirectory(),
- FtpListOption.Modify | FtpListOption.Size | FtpListOption.DerefLinks)) {
- switch (item.Type) {
- case FtpFileSystemObjectType.Directory:
- break;
- case FtpFileSystemObjectType.File:
- break;
- case FtpFileSystemObjectType.Link:
- if (item.LinkObject != null) {
-
- }
- break;
- }
- }
- }
- }
- }
- }
|