![]() |
|
|
Published: Tuesday, September 29, 1998 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 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:
Result: 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]
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||