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, 01: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: 54
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, 02: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!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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





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