Also für die Dateien habe ich es schon mal hinbekommen:
Delphi-Quellcode:
procedure TDTListDir.FindFiles(RootFolder: AnsiString; Mask: AnsiString = '*.*'; Recurse: Boolean = True);
var
SR: TSearchRec;
i: Integer;
Tab: AnsiString;
begin
RootFolder := IncludeTrailingPathDelimiter(RootFolder);
if Recurse then
if FindFirst(RootFolder + '*.*', faAnyFile, SR) = 0 then
try
repeat
if SR.Attr and faDirectory = faDirectory then
if (SR.Name <> '.') and (SR.Name <> '..') then
begin
FindFiles(RootFolder + SR.Name, Mask, Recurse);
end;
until FindNext(SR) <> 0;
finally
FindClose(SR);
Inc(FLevel);
end;
if FindFirst(RootFolder + Mask, faAnyFile, SR) = 0 then
try
for i := 0 to FLevel do
Tab := Tab + ' ';
repeat
if SR.Attr and faDirectory <> faDirectory then
begin
sl.Add(Tab + SR.Name + Format('(%d, %s)',
[SR.Size, FormatDateTime('yyyy-mm-dd hh:nn:ss', FileDateToDateTime(SR.Time))]));
end;
until FindNext(SR) <> 0;
finally
FindClose(SR);
end;
end;
Nur bei den Ordnern hapert es noch. Wie bekomme ich das hin?