'Ä=Ž , Ö=™ , Ü=š ; ä=„ , ö=”, ü= , ß=á ,§=õ , ©=¸
'©¸2010 by ytwinky, MD
'Grundlage ist unter anderem auch FindFirstFile von yetifoot, schönen Dank dafür..
'Todo: rekursiver Aufruf für Unterverzeichnisse
' Ausgabe als Csv-Datei
#include "windows.bi"
#include "vbcompat.bi"
'Width 90,30
'type WIN32_FIND_DATAA
' dwFileAttributes as DWORD
' ftCreationTime as FILETIME
' ftLastAccessTime as FILETIME
' ftLastWriteTime as FILETIME
' nFileSizeHigh as DWORD
' nFileSizeLow as DWORD
' dwReserved0 as DWORD
' dwReserved1 as DWORD
' cFileName as zstring * 260
' cAlternateFileName as zstring * 14
'end type
Function ColorDate(systime As SYSTEMTIME) As String
Var s="
", diff=DateDiff("d", DateSerial(Systime.wYear, Systime.wMonth, Systime.wDay), Now())
Var t=Format(SysTime.wDay, "00") &"." & Format(SysTime.wMonth, "00") &"." & SysTime.wYear
Return s & *IIf(diff<8, @"", @"") & " " & t & *IIf(diff<8, @"", @"") &" | "
End Function
Function MkTd(td As WIN32_FIND_DATA, i As Integer) As String
Dim systime As SYSTEMTIME, localtime As FILETIME, TdLn As String
FileTimeToLocalFileTime(@td.ftLastWriteTime, @localtime)
FileTimeToSystemTime(@localtime, @systime)
TdLn=" " &td.cFileName &" | " & ColorDate(Systime)
TdLn &=" " &(Format(Val("&h" & Hex(td.nFileSizeHigh) & Hex(td.nFileSizeLow)), "######"))
Return TdLn &" | "
End Function
Dim ffd As WIN32_FIND_DATA
Dim hFind As HANDLE
Dim FolderName As String
Dim As Integer dwError, i, j, k=-1, DNr=FreeFile
Dim As String s, n, z
Dim As WIN32_FIND_DATA list()
Input "OrdnerNamen eingeben(cr=default):", FolderName
If FolderName="" Then FolderName="D:\Sprachen\FreeBASIC\ytwinky.freebasic-portal.de\freebasic"
s=Format(Now(), "dd.mm.yyyy")
z=!"\n\n\n"
z &="Datei-Liste v" &s &!" erstellt mit FBDir2Html.Bas von ytwinky, MD |
\n"
z &="FileName | FileDate | FileSize | "
z &=!"FileName | FileDate | FileSize | FileName | FileDate | FileSize |
\n"
hFind=FindFirstFile(FolderName &"\*", @ffd)
If hFind=INVALID_HANDLE_VALUE Then
Print !"Ooops, Ordner nicht gefunden:\n" &FolderName
GetKey
End
Else
Do
Select Case Right(lcase(ffd.cFileName), 4)
Case ".", "..", ".htm", "html", ".gif", ".php"
Case Else
k += 1
ReDim Preserve List(k)
List(k)=ffd
End Select
Loop Until FindNextFile(hFind, @ffd)=0
FindClose hFind
End If
For i=0 To k Step 3
z &=""
For j=0 To 2
If (i+j)<=k Then z &=MkTd(List(i+j), i) Else z &=" | | | "
Next
z &=!"
\n"
Next
z+=!"
\n\n"
Open FolderName &"\index.html" For OutPut As #DNr
Print #DNr, z
Close #Dnr
Print "getestet mit FB 0.23.0 und FBEdit"
Print k &" Dateien"
Shell FolderName &"\index.html"