ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 24th, 2003, 06:21 AM
howa howa is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 3 howa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
sort filenames with download links by date - multidimensional array ??

hi fellas !

i use this script to generate download links from directories which are first passed to an script to record the number a link is clicked.

the function is calle with a path like:
ListFolderContents(Server.MapPath("/dir1"))

my question now is:
can i write this to an multidimensional array (or object oriented?) - and then sort it by date ?? if so how ?

any ideas ?
thx

<% sub ListFolderContents(path)

dim fs, folder, file, item, url, a

set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)

'Display the target folder and info.


Response.Write("<li><span class="""& cold &""">" & folder.Name _
&"</span>")

Response.Write("<ul>" & vbCrLf)

'Display a list of sub folders.
for each item in folder.SubFolders
ListFolderContents(item.Path)
next

'Display a list of files.

for each item in folder.Files
url = MapURL(item.path)
helpurl = url

Response.Write("<li><a href=""../asp/clicks.asp?url=" & url & """>" & item.Name & "</a> - <span class=""grey"">Downloads:["&hold1&"] - " &_
(Round(item.Size/1024/1024, 2)) & " MB, " _
& " " & item.DateLastModified & "." _
&"</span></li>")

next

Response.Write("</ul>" & vbCrLf)
Response.Write("</li>" & vbCrLf)

end sub

function MapURL(path)

dim rootPath, url

'Convert a physical file path to a URL for hypertext links.

rootPath = Server.MapPath("../../..")
url = Right(path, Len(path) - Len(rootPath))
MapURL = Replace(url, "\", "/")

end function %>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > sort filenames with download links by date - multidimensional array ??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT