Moin !
So nun schaut das schon etwas universeller und läuft ohne Fehler
Delphi-Quellcode:
Procedure ReadAllFilesInDir(mask: string; Var Liste : TStringList;
readFolder, readFiles : Boolean);
var sr : TSearchRec;
directory : string;
begin
directory := ExtractFilePath(mask);
if FindFirst(mask, faAnyFile, sr) = 0 then
begin
repeat
if (lowercase(sr.Name) <> 'make.exe') and
(lowercase(sr.Name) <> 'install.xml') and
(sr.Name <> '.') and
(sr.Name <> '..') and
((sr.Attr and faDirectory) <> faDirectory) then
if readFiles then
Liste.Add(ExpandFileName(directory + sr.Name));
if ((sr.Attr and faDirectory) = faDirectory) and
(sr.Name <> '.') and
(sr.Name <> '..') then begin
if readFolder then
Liste.Add(ExpandFileName(directory + sr.Name));
ReadAllFilesInDir(directory + sr.Name + '\' + ExtractFileName(mask), Liste, readFolder, readFiles);
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
end;