Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

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 ASP Free Forums Sponsor:
  #1  
Old March 1st, 2006, 12:40 AM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
ASP Full Directory Structure

I think I posted a small example of displaying the content of a particular folder before. This one still display your entire folder/file hierarchy. It's from brainjar.
ASP Code:
Original - ASP Code
  1. <%@ LANGUAGE="VBScript" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <% '*************************************************  **************************
  4.    '* ASP Directory Listing                                                   *
  5.    '*                                                                         *
  6.    '* Do not remove this notice.                                              *
  7.    '*                                                                         *
  8.    '* Copyright 1999, 2000 by Mike Hall.                                      *
  9.    '* Please see http://www.brainjar.com for documentation and terms of use.  *
  10.    '*************************************************  **************************
  11. %>
  12. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  13. <head>
  14. <title>ASP Directory Listing Demo</title>
  15. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  16. <link rel="stylesheet" type="text/css" href="/common/default.css" />
  17. </head>
  18. <body>
  19.  
  20. <div id="demoBox">
  21.  
  22. <h3>ASP Directory Listing Demo</h3>
  23.  
  24. <p>Three separate directories from the web server root are displayed below
  25. ("asp", "dhtml" and "js"), showing all subdirectories and files. Additionally,
  26. each file is displayed as a link.</p>
  27.  
  28. </div>
  29.  
  30. <!-- List these three folders. -->
  31. <ul>
  32. <% ListFolderContents(Server.MapPath("/")) %>
  33. </ul>
  34.  
  35. </body>
  36. </html>
  37.  
  38. <% sub ListFolderContents(path)
  39.  
  40.      dim fs, folder, file, item, url
  41.  
  42.      set fs = CreateObject("Scripting.FileSystemObject")
  43.      set folder = fs.GetFolder(path)
  44.  
  45.     'Display the target folder and info.
  46.  
  47.      Response.Write("<li><b>" & folder.Name & "</b> - " _
  48.        & folder.Files.Count & " files, ")
  49.      if folder.SubFolders.Count > 0 then
  50.        Response.Write(folder.SubFolders.Count & " directories, ")
  51.      end if
  52.      Response.Write(Round(folder.Size / 1024) & " KB total." _
  53.        & vbCrLf)
  54.  
  55.      Response.Write("<ul>" & vbCrLf)
  56.  
  57.      'Display a list of sub folders.
  58.  
  59.      for each item in folder.SubFolders
  60.        ListFolderContents(item.Path)
  61.      next
  62.  
  63.      'Display a list of files.
  64.  
  65.      for each item in folder.Files
  66.        url = MapURL(item.path)
  67.        Response.Write("<li><a href=""" & url & """>" & item.Name & "</a> - " _
  68.          & item.Size & " bytes, " _
  69.          & "last modified on " & item.DateLastModified & "." _
  70.          & "</li>" & vbCrLf)
  71.      next
  72.  
  73.      Response.Write("</ul>" & vbCrLf)
  74.  
  75.      Response.Write("</li>" & vbCrLf)
  76.  
  77.    end sub
  78.  
  79.    function MapURL(path)
  80.  
  81.      dim rootPath, url
  82.  
  83.      'Convert a physical file path to a URL for hypertext links.
  84.  
  85.      rootPath = Server.MapPath("/")
  86.      url = Right(path, Len(path) - Len(rootPath))
  87.      MapURL = Replace(url, "\", "/")
  88.    end function %>
__________________
If you found a post of mine helpful, please click on the on my post to add to my reputation.


Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > ASP Full Directory Structure


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 5 hosted by Hostway
Stay green...Green IT