Hallo,
das Prinzip sollte dir schon bekannt vorkommen:
Delphi-Quellcode:
procedure AllFolders(const root: string; s: TStrings);
var
sr: TSearchRec;
path: string;
begin
path := IncludeTrailingPathDelimiter(root);
if FindFirst(path + '*', faDirectory, sr) = 0 then
try
repeat
if (sr.Name = '.') or (sr.Name = '..') then
Continue
else
if (sr.Attr and faDirectory) = faDirectory then
begin
s.Add(path + sr.Name);
AllFolders(path + sr.Name, s)
end;
until FindNext(sr) <> 0;
finally
FindClose(sr);
end;
end;
procedure TDemoForm.Test;
begin
with ListBox do
begin
Items.BeginUpdate;
AllFolders('C:\daten', Items);
Items.EndUpdate;
end;
end;
Grüße vom marabu