Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Directory.GetDirectories display order

Reply
Thread Tools

Directory.GetDirectories display order

 
 
=?Utf-8?B?TWlrZSBE?=
Guest
Posts: n/a
 
      03-30-2005
Can I control the order that files, folders are displayed? Can I do them
alphabetically or do I need to upload to a db like we did in asp?

items = Directory.GetDirectories(path)
For Each item In items
Response.Write(Replace(item, "F:\Inetpub\wwwroot\", "") & " <br
/>")
Next

Thanks
Mike
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlrZSBE?=
Guest
Posts: n/a
 
      03-30-2005
Not pretty but it works

Public Function GetFolderInfo(ByVal strPath As String) As String
Dim item As String
Dim items() As String
Dim path As String = "F:\Inetpub\wwwroot\" & strPath

Dim arFolderArray As String

items = Directory.GetDirectories(path)

For Each item In items
arFolderArray = arFolderArray & Replace(item, path & "\", "") &
","
Next

Dim arFolder As Array
arFolderArray = Left(arFolderArray, Len(arFolderArray) - 1)

arFolder = Split(arFolderArray, ",")
Array.Sort(arFolder)
Dim x As Integer = 0

For x = 0 To UBound(arFolder)
Response.Write(arFolder(x) & " <br />")
Next
End Function

Mike

"Mike D" wrote:

> Can I control the order that files, folders are displayed? Can I do them
> alphabetically or do I need to upload to a db like we did in asp?
>
> items = Directory.GetDirectories(path)
> For Each item In items
> Response.Write(Replace(item, "F:\Inetpub\wwwroot\", "") & " <br
> />")
> Next
>
> Thanks
> Mike

 
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
If you get an order # does it mean the order is accepted? =?Utf-8?B?U3RldmUxMDc3?= Windows 64bit 3 05-12-2005 11:46 PM
Traversion order cf. output order in XSL Soren Kuula XML 2 02-01-2004 09:10 AM
In which order are files looked for when loaded/requierd - and what'sthe order of suffixes? Stephan Kämper Ruby 2 01-18-2004 02:07 PM
Query and Display an order list using DataList Homa ASP .Net 2 10-19-2003 10:07 PM
How to Display DropDownList with preserved order (custom order) cspoh ASP .Net Web Controls 0 07-31-2003 09:19 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57