Directory Browsing

Discussion in 'ASP .Net' started by =?Utf-8?B?TWFubnkgQ2hvaGFu?=, Mar 15, 2005.

  1. Hi Guys,
    I am currently programming in Vb .net. I am stuck at point. i have a root
    directory
    C:\test
    which has couple of sub-folders c:\test\test1 ; c:\test\test2 ;
    c:\test\test1\test4 and so on.

    I need to create a list box with parent directory and its sub directories
    below it for all the folders inside the root directory and sub-folders etc.
    I have tried numerous approaches, can someone please tell me how to get this
    done. Any articlet that i can take a look at?

    Thanks

    manny
    =?Utf-8?B?TWFubnkgQ2hvaGFu?=, Mar 15, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?TWFubnkgQ2hvaGFu?=

    Derek Harmon Guest

    "Manny Chohan" <> wrote in message news:...
    > I have tried numerous approaches, can someone please tell me how to get this
    > done.


    What have you tried so far?

    > I need to create a list box with parent directory and its sub directories
    > below it for all the folders inside the root directory and sub-folders etc.


    Have you tried databinding the ListBox to the array of subdirectories
    returned from the Directory.GetDirectories( "C:\test") function call?
    Then add "C:\test" manually.

    > Any articlet that i can take a look at?


    http://msdn.microsoft.com/library/e...systemiodirectoryclassgetdirectoriestopic.asp

    Don't forget to ensure your ASPNET user account has the security
    permissions granted to discover these paths, or you'll receive a
    SecurityException.


    Derek Harmon
    Derek Harmon, Mar 15, 2005
    #2
    1. Advertising

  3. =?Utf-8?B?TWFubnkgQ2hvaGFu?=

    Karl Seguin Guest

    Manny:
    The quickest solution I could come up with was:

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    If Not Page.IsPostBack Then
    Dim list As ArrayList = GetDirectories("c:\test")
    ddl.DataSource = list
    ddl.DataBind()
    End If

    End Sub

    Public Shared Function GetDirectories(ByVal path As String) As ArrayList
    Dim list As New ArrayList
    For Each subs As String In IO.Directory.GetDirectories(path)
    list.Add(subs)
    list.AddRange(GetDirectories(subs))
    Next
    Return list
    End Function


    hopefully it gives you a place to start...

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)


    "Manny Chohan" <> wrote in message
    news:...
    > Hi Guys,
    > I am currently programming in Vb .net. I am stuck at point. i have a root
    > directory
    > C:\test
    > which has couple of sub-folders c:\test\test1 ; c:\test\test2 ;
    > c:\test\test1\test4 and so on.
    >
    > I need to create a list box with parent directory and its sub directories
    > below it for all the folders inside the root directory and sub-folders

    etc.
    > I have tried numerous approaches, can someone please tell me how to get

    this
    > done. Any articlet that i can take a look at?
    >
    > Thanks
    >
    > manny
    Karl Seguin, Mar 15, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Katrina

    directory browsing

    Katrina, Dec 1, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    384
    Steve C. Orr [MVP, MCSD]
    Dec 1, 2003
  2. Big Tony

    Virtual Directory Browsing question

    Big Tony, Jan 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    435
    Scott Allen
    Jan 25, 2004
  3. Tim Smith
    Replies:
    0
    Views:
    390
    Tim Smith
    Dec 7, 2004
  4. Dmitry Duginov

    ISAPI filter and directory browsing

    Dmitry Duginov, Feb 26, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    425
    Steven Cheng[MSFT]
    Feb 28, 2005
  5. Joe Kovac
    Replies:
    2
    Views:
    324
    bruce barker
    Oct 11, 2007
Loading...

Share This Page