When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs



















internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

Web Developer
Chicago Public Radio
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume

Published: Tuesday, September 29, 1998

VBScript DIR Function


This code was written by Toby Gramm, webmaster of Techfools.com.


DIR


Yep it's kinda like the old school DOS days.

Put this code in a file and name it "dir.asp", make sure that this

- continued -

is used in a secure directory, cuz this has to potenial to expose you whole file system to the Web! Can be very useful, can also shoot you in the foot. Use this wisely!

Example:
http://www.techfools.com/code/dir/dir.asp?PP=G:\InetPub\wwwroot\techfools\code\dir\&UU=http://www.techfools.com/code/dir/
Note: Of course you would URLencode this.

Result:
Folder

code.txt
default.asp
fCount.asp
Sample.asp

Da' Code


<%@ LANGUAGE="VBSCRIPT" %>
<%

'Written by: Toby Gramm
'070698
'Modified 092998 - Added support for Folders.
'		   As suggested by Bill Wilkinson [BillW@chilisoft.com]

Sub Main()
	sPP = Request.QueryString("PP") 'Physical Path
	sUP = Request.QueryString("UP") 'URL Path

	Set fso = CreateObject("Scripting.FileSystemObject")
	Set f = fso.GetFolder(sPP)  
	Set fc = f.Files 
	Set ff = f.SubFolders 
	For Each f1 in ff	
  	  Response.Write "<a href=" & sUP & f1.name & ">" & f1.name & "</a> <br>"
	Next  
	Response.Write "<br>"
	For Each f1 in fc
	  Response.Write "<a href=" & sUP & f1.name & ">" & f1.name & "</a> <br>"
	Next  
	Set ff = nothing
	Set fso = nothing
	Set f = nothing
	Set fc = nothing
End Sub
%>
Main()


[Visit Techfools.com] [Email Webmaster]


Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers