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,662 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 43 m 24 sec
Reputation Power: 55
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
  #2  
Old April 27th, 2009, 01:16 PM
bobshishka bobshishka is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 54 bobshishka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 26 m 49 sec
Reputation Power: 5
Any idea how to sort the files displayed in alphabetical order?

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





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

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





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek