<%
Dim nIndentLevel
nIndentLevel = 1
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim ts
ListFolderContents(Server.MapPath("/Crawdaddy"))
%>
<% sub ListFolderContents(path)
dim fs, folder, file, item, url
set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)
'Display the target folder and info.
dim strSpaces
for i = 0 to nIndentLevel * 4
strSpaces = strSpaces + " "
Next
Response.Write(strSpaces + "
" & folder.Name & "
")
Response.Write(vbCrLf & "
" & vbCrLf)
'Display a list of sub folders.
for each item in folder.SubFolders
nIndentLevel = nIndentLevel + 1
ListFolderContents(item.Path)
next
'Display a list of files.
if folder.Files.Count > 0 Then
'Set ts = fs.CreateTextFile(folder + "\playList.wpl", True)
'CreatePlayList ts
for each item in folder.Files
url = MapURL(item.path)
Dim FileExt
FileExt = Mid(item.Name, Len(item.Name) - 2)
if FileExt = "mp3" then
'WriteSong ts, url
end if
next
'WriteEndSeq ts
End If
for each item in folder.Files
url = MapURL(item.path)
FileExt = Mid(item.Name, Len(item.Name) - 2)
if FileExt = "txt" Or FileExt = "mp3" or FileExt = "wpl" then
Response.Write(strSpaces + "
" & 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
Sub CreatePlayList( ts )
ts.WriteLine ("")
ts.WriteLine("")
ts.WriteLine(" ")
ts.WriteLine(" ")
ts.WriteLine(" Blues")
ts.WriteLine(" ")
ts.WriteLine(" ")
ts.WriteLine(" ")
End Sub
Sub WriteEndSeq(ts)
ts.WriteLine(" ")
")
ts.WriteLine(" ")
End Sub
Sub WriteSong( ts, song )
song = "http://www.steveandmarianne.com" + song
somg = Replace (song, " ", "%20")
ts.WriteLine(" ")
End Sub
%>