%@ LANGUAGE="VBScript" %>
dir
Volume in drive E is SMASON
Volume Serial Number is 0618-0339
<% ListFolderContents(Server.MapPath(".")) %>
<% sub ListFolderContents(path)
dim fs, folder, file, item, url, pad, csize
set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)
'Display the target folder and info.
dir=MapDIR(path)
Response.Write(" Directory of E:" & dir )
Response.Write(vbCrLf)
Response.Write(vbCrLf)
Response.Write(vbCrLf)
'Display a list of sub folders.
Response.Write(" " & folder.DateLastModified & " <DIR> ." & vbCrLf)
Response.Write(" " & folder.DateLastModified & " <DIR> .." & vbCrLf)
for each item in folder.SubFolders
url = MapURL(item.path)
Response.Write(" " & item.DateLastModified & " <DIR> ")
Response.Write("" & item.Name & "" & vbCrLf)
next
'Display a list of files.
for each item in folder.Files
If item.name <> "index.asp" Then
url = MapURL(item.path)
Response.Write(" " & item.DateLastModified & " ")
csize = Make_Comma_Number(item.Size)
For i=0 to 10-Len(csize)
Response.Write(" ")
Next
Response.Write(csize & pad & " " & item.Name & "" & vbCrLf)
End if
next
Response.Write(" " & folder.Files.Count-1 & " File(s)")
csize = Make_Comma_Number(folder.Size)
For i=0 to 17-Len(csize)
Response.Write(" ")
Next
Response.Write(csize & " bytes" & vbCrLf)
Response.Write(" " & folder.SubFolders.Count & " Dir(s) very few bytes free")
Response.Write(vbCrLf)
Response.Write(vbCrLf)
end sub
function MapURL(path)
dim rootPath, url
'Convert a physical file path to a URL for hypertext links.
rootPath = Server.MapPath("/")
url = Right(path, Len(path) - Len(rootPath))
MapURL = Replace(url, "\", "/")
end function
function MapDIR(path)
dim rootPath, url
'Convert a physical file path to a URL for hypertext links.
rootPath = Server.MapPath("/")
url = Right(path, Len(path) - Len(rootPath))
MapDIR = url
end function
Function Make_Comma_Number(Data)
HowMany = Len(Data)
If HowMany < 4 Then
Make_Comma_Number = Data
Else
'Add in commas----------------------
For i = 1 To HowMany
NewData = Mid(Data, i, 1) & NewData
Next
For a = 1 To HowMany
Counter = Counter + 1
If Counter = 4 Then
DataOf = Mid(NewData, a, 1) & "," & DataOf
Counter = 1
Else
DataOf = Mid(NewData, a, 1) & DataOf
End If
Next
'-----------------------------------
Make_Comma_Number = DataOf
End If
End Function
%>