''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Script : Verzeichnis in einer
HTML-Datei ausgeben '
' File : 04_02_Dir2HTML.vbs '
' Date : 2007-02-08 - Last modified: 2007-02-08 '
' '
' Michael Puff - [
url]http://www.michael-puff.de[/
url] '
' '
' Durch ein File-Container Attribut iterieren '
' Erzeugen einer Textdatei '
' Aufruf des IE-
COM Objektes '
' Funktionsaufrufe '
' Dynamische Arrays '
' '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Constants
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
FOLDER = "D:\Homepage\michael-puff.de\Berufsschule\Anwendungsentwicklung - Johlen\VBScripte"
HTMLFILE = "index.html"
STYLESHEET = "D:\Homepage\michael-puff.de\Berufsschule\Anwendungsentwicklung - Johlen\VBScripte\stylesheet.css"
OUTFOLDER = "D:\Homepage\michael-puff.de\Berufsschule\Anwendungsentwicklung - Johlen\VBScripte"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
dim file_array()
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Subs
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Page header
private sub HTMLHeader(ts)
ts.WriteLine "<
html>"
ts.WriteLine "<head><link rel='stylesheet' type='text/css' href='" & STYLESHEET & "'></head>"
ts.WriteLine "<body>"
end sub
' Page footer
private sub HTMLFooter(ts)
ts.WriteLine "</body>"
ts.WriteLine "</
html>"
end sub
' BubbleSort
function bubblesort(arrSortieren)
for i = 0 to ubound(arrSortieren)
for j = i + 1 to ubound(arrSortieren)
if arrSortieren(i) > arrSortieren(j) then
arrTemp = arrSortieren(i)
arrSortieren(i) = arrSortieren(j)
arrSortieren(j) = arrTemp
end if
next
next
bubblesort = arrSortieren
end function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.CreateTextFile(OUTFOLDER & HTMLFILE)
HTMLHeader(ts)
Set fo = fso.GetFolder(FOLDER)
title = "Index of " & fo.Path
ts.WriteLine "<h2>" & title & "</h2>
"
ts.WriteLine "<table class='dir'>"
ts.WriteLine "<th class='date'>Last modified</th><th class='size'>Size</th><th class='name'>file name</th>"
Set files = fo.Files
i = 0
ReDim file_array(files.Count)
For Each file in files
file_array(i) = file
i = i + 1
Next
For i = 0 to ubound(file_array)
Set file = file_array(i)
Filedate = file.DateLastModified
Filesize = file.Size
Filename = file.Name
ts.WriteLine "<tr>"
ts.WriteLine "<td class='date'>" & Filedate & "</td>"
ts.WriteLine "<td class='size'>" & Filesize & "</td>"
ts.WriteLine "<td class='name'>[
url='" & fo.Path & "/" & Filename & "']" & Filename & "[/
url]</td>"
ts.WriteLine "</tr>"
Next
ts.WriteLine "<tr><td class='date'>File(s): " & fo.files.Count & "</td></tr>"
ts.WriteLine "</table>"
HTMLFooter(ts)
ts.Close
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set ie = CreateObject("InternetExplorer.Application.1")
ie.Visible = True
ie.Navigate(OUTFOLDER & HTMLFILE)