'v5.9******************************************************** ' File: dateiliste-nach-datum.vbs ' Autor: dieseyer@gmx.de ' dieseyer.de ' ' Zeigt die Dateien eines Ordners nach Änderungsdatum sortiert an. '************************************************************ Option Explicit ' Siehe http://dieseyer.de/dse-wsh-lernen.html#OptionExpl Dim fso : Set fso = WScript.CreateObject("Scripting.FileSystemObject") Dim Pfad, Ttt, Txt, Tst, i Dim oFolders, oFiles, DateiX Pfad = "c:\" ' Dateiliste => http://dieseyer.de/scr-html/datei-verzeichnis-liste.html: i = 0 Set oFolders = fso.GetFolder( Pfad ) Set oFiles = oFolders.Files For Each DateiX In oFiles Ttt = DateiX.DateLastModified ' Ttt = "22.6.2005 17:22:11" ' Ttt = "2005-06-22 17:22:12" Tst = DateDiff( "s", CDate( Ttt ), Now() ) Txt = String( 11 - Len( Tst ), "0" ) & Tst ' MsgBox Ttt & vbCRLF & CDate( Ttt ) & vbCRLF & Tst & vbCRLF & Txt ReDim Preserve Datei(i) Datei(i) = Txt & DateiX.Name & " " & vbTab & "letzte Änderung: " & Ttt i = i + 1 Next Set oFiles = nothing Set oFolders = nothing ' sortieren => http://dieseyer.de/dse-wsh-scr-d.html#sortbub QuickSort Datei, LBound(Datei), UBound(Datei) Txt = "" ' korregieren: For i = LBound( Datei ) to UBound( Datei ) Datei(i) = Mid ( Datei(i), 12 ) Txt = Txt & Datei(i) & vbCRLF Next MsgBox Txt, , WScript.ScriptName function QuickSort(vntArray, intVon, intBis) ' funtion Anfang ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' http://www.heise.de/ct/ftp/listings.shtml ' Der gute, alte QuickSort-Algorithmus als Windows-Script. c't 5/2002 ' Copyright Ralf Nebelo/c't ' Private Sub QuickSort(vntArray, intVon, intBis) Dim i, j Dim vntTestWert, intMitte, vntTemp If intVon < intBis Then intMitte = (intVon + intBis) \ 2 vntTestWert = vntArray(intMitte) i = intVon j = intBis Do Do While UCase( vntArray(i) ) < Ucase( vntTestWert ) ' Do While vntArray(i) < vntTestWert i = i + 1 Loop Do While UCase( vntArray(j) ) > Ucase( vntTestWert ) ' Do While vntArray(j) > vntTestWert j = j - 1 Loop If i <= j Then vntTemp = vntArray(j) vntArray(j) = vntArray(i) vntArray(i) = vntTemp i = i + 1 j = j - 1 End If Loop Until i > j If j <= intMitte Then Call QuickSort(vntArray, intVon, j) Call QuickSort(vntArray, i, intBis) Else Call QuickSort(vntArray, i, intBis) Call QuickSort(vntArray, intVon, j) End If End If end Function ' QuickSort(vntArray, intVon, intBis)