How to browse directories of an IP address

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jaswiel
    New Member
    • Mar 2011
    • 4

    How to browse directories of an IP address

    Hello,I was wondering how to write code to enable me to browse directories of an IP address that i enter into a textbox. I want to browse the directories and select one to compare it with another directory on my local host. This is done in a Windows Forms application. Please help if possible.
  • tourrider
    New Member
    • Mar 2011
    • 3

    #2
    You can browse UNC resources via Ip address. You'll need access to a share on the host machine.

    this example shows access to the administrative share on the localhost(127.0 .0.1).

    string myIPaddress = "\\\\127.0.0.1\ \C$";
    string[] folders = Directory.GetDi rectories(myIPa ddress);
    foreach (string file in folders)
    Console.WriteLi ne(Path.GetFile Name(file));


    Using a resolvable hostname works too..

    string myHostName = "\\\\hrPC001619 04\\C$";
    string[] folders = Directory.GetDi rectories(myHos tName);
    foreach (string file in folders)
    Console.WriteLi ne(Path.GetFile Name(file));


    Cheers !

    Comment

    • Jaswiel
      New Member
      • Mar 2011
      • 4

      #3
      Thanks for the answer, problem is it is a windows GUI application so i want to list the directory contents in a listView control and i want to compare the if the files are the same in both directories and compare file versions of the files that are the same. Thanks for your help. I am really lost on this and would greatly appreciate it if you could help me?

      Comment

      • Jaswiel
        New Member
        • Mar 2011
        • 4

        #4
        And how do I connect to the IP of another computer? What connection should I use? I am really inexperienced with this sort of thing.

        Comment

        • tourrider
          New Member
          • Mar 2011
          • 3

          #5
          Find the attached project.

          It shows how to use the Directory and File classes.

          This should give you some ideas.
          Attached Files

          Comment

          • Jaswiel
            New Member
            • Mar 2011
            • 4

            #6
            Thank you it has given me ideas. Do you know how to list the file versions with the file names in the listView? that would really help me a lot. Major problem is sorted out now, thank you so much, now I just have to figure out how to compare if both directories contain the same files and same file versions of those files. Please help if possible?

            Comment

            Working...