Lists all files and directories under the specified directory

Source: Internet
Author: User
<%@ LANGUAGE = VBScript%>
<%Server.ScriptTimeout=5000%>

<style type= "Text/css" >
/* Outline Style Sheet * *
UL ul {display:none;
MARGIN-LEFT:20PT}
</style>
<script language= "JavaScript" >
function checkparent (src, dest) {
Search for a specific parent of the current element
while (Src!=null) {
if (Src.tagname = = dest) return src;
src = src.parentelement;
}
return null;
}
function outline () {
Expand or collapse If a list item is clicked.
var open = event.srcelement;
Make sure clicked inside a LI. This test allows rich HTML inside lists.
var el = checkparent (Open, "LI");
if (Null!=el) {
var pos = 0;
Search for a nested list
for (var pos=0; pos<el.children.length; pos++) {
if ("UL" ==el.children[pos].tagname) break;
}
if (pos==el.children.length) return;
else return;
El = El.children[pos];
if ("UL" ==el.tagname) {
Expand or Collapse nested list
if ("" ==el.style.display) {
El.style.display = "block";
el.style.listStyleImage = "url (images/folder.gif)";
el.parentElement.style.listStyleImage = "url (images/ofolder.gif)";
}
Else
{
El.style.display = "";
el.parentElement.style.listStyleImage = "url (images/folder.gif)";
}
}
Event.cancelbubble = true;
}
Document.onclick = outline;
</script>

<base target= "Main" >
<title>Folders</title>
<link rel= "stylesheet" type= "Text/css" href= "Ase.css" >

<body topmargin= "0" leftmargin= "0" >

<script Language=vbscript RUNAT = server>
Dim FS, Folderpara, Folderarray
Set fs = CreateObject ("Scripting.FileSystemObject")
If not IsEmpty (Request ("Txtrelative")) Then
Folderpara=server.mappath (Request ("txtrelative"))
Else
Folderpara=request ("Txtabsolute")
End If
Response.Write "<UL>"
Response.Write "<li style=" List-style-image:url (images/folder.gif) ' ><a href= ' files.asp?sPath= ' &
Folderpara & "' >" & Folderpara & "</a></LI>"
Call Showfolderlist (Folderpara)
Response.Write "</UL>"
Set fs = Nothing

Sub showfolderlist (FOLDERSPEC)
Dim F, F1, FC, S,fs
Set fs=server.createobject ("Scripting.FileSystemObject")
Set f = fs. GetFolder (FOLDERSPEC)
Set FC = F.subfolders
Set Fs=f.files
' If (not (Fc.count = 0)) Then
Response.Write "<UL>"
For each F1 in FC
s = f1.name
If ((left (s, 1) = "_") Then
Response.Write "<li>"
Response.Write "<a href= ' files.asp?spath=" & F1 & "' >"
Response.Write S & "</LI>"
Response.Write "</a>"
Call Showfolderlist ((Folderspec & "/" & S))
End If
Next

For each F1 in FS
s = f1.name
If ((left (s, 1) = "_") Then
Response.Write "<li>"
Response.Write "<a href= ' files.asp?spath=" & F1 & "' ><font color=666666>"
If InStr (S, "product") >0 Then
Response.Write Replace (S, "Product", "<font color=008800>product</font>")
Else
If InStr (S, "prod") >0 then
Response.Write Replace (S, "prod", "<font color=008800>prod</font>")
Else
Response.Write S
End If
End If
Response.Write "</f



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.