Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Get Remote server sub directories

Get Remote server sub directories

Scheduled Pinned Locked Moved C#
sysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vishnukamath
    wrote on last edited by
    #1

    Hi, I tried with below code and i'm getting only root directories not sub directories , i need to get sub directories please suggest me better way. string ftpServerIP = "75.125.2.193"; FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://" + ftpServerIP + "/"); request.Method = WebRequestMethods.Ftp.ListDirectoryDetails; request.Credentials = new NetworkCredential("barikgr2", "barik122"); FtpWebResponse response = (FtpWebResponse)request.GetResponse(); Stream responseStream = response.GetResponseStream(); StreamReader reader = new StreamReader(responseStream); string line; while ((line = reader.ReadLine()) != null) { TreeNode node = new TreeNode(); string[] _arv = line.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); node.Text = _arv[3]; treeView1.Nodes.Add(node); } reader.Close(); response.Close(); Regards, Vishnu.

    L 1 Reply Last reply
    0
    • V vishnukamath

      Hi, I tried with below code and i'm getting only root directories not sub directories , i need to get sub directories please suggest me better way. string ftpServerIP = "75.125.2.193"; FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://" + ftpServerIP + "/"); request.Method = WebRequestMethods.Ftp.ListDirectoryDetails; request.Credentials = new NetworkCredential("barikgr2", "barik122"); FtpWebResponse response = (FtpWebResponse)request.GetResponse(); Stream responseStream = response.GetResponseStream(); StreamReader reader = new StreamReader(responseStream); string line; while ((line = reader.ReadLine()) != null) { TreeNode node = new TreeNode(); string[] _arv = line.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); node.Text = _arv[3]; treeView1.Nodes.Add(node); } reader.Close(); response.Close(); Regards, Vishnu.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      public int NumFilesAndDirs {get; } more info ^

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups