Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Directory Browsing

Reply
Thread Tools

Directory Browsing

 
 
=?Utf-8?B?TWFubnkgQ2hvaGFu?=
Guest
Posts: n/a
 
      03-15-2005
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
 
Reply With Quote
 
 
 
 
Derek Harmon
Guest
Posts: n/a
 
      03-15-2005
"Manny Chohan" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> 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/en...oriestopic.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


 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      03-15-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory Browsing for one directory only Joe Kovac ASP .Net 2 10-11-2007 03:22 PM
Remote Site Replication, directory browsing, and default.aspx Tim Smith ASP .Net 0 12-07-2004 05:19 AM
HELP: Directory browsing on IIS does not work from outside WQ Cisco 1 06-28-2004 04:03 AM
Virtual Directory Browsing question Big Tony ASP .Net 1 01-25-2004 03:27 PM
directory browsing Katrina ASP .Net 1 12-01-2003 04:24 AM



Advertisments