Delphi-Quellcode:
uses SysUtils;
procedure getFilesInDirectory(Directory: string; const Mask: string;
WithSubDirs: Boolean; Files:TStrings);
procedure ScanDir(const Directory: string);
var SR: TSearchRec;
begin
if FindFirst(Directory + Mask, faAnyFile and not faDirectory, SR) = 0 then
begin
try
repeat
Files.Append(Directory + SR.Name);
until FindNext(SR) <> 0;
finally
FindClose(SR);
end;
end;
if WithSubDirs then begin
if FindFirst(Directory + '*.*', faAnyFile, SR) = 0 then
begin
try
repeat
if ((SR.attr and faDirectory) = faDirectory)
and (SR.Name <> '.')
and (SR.Name <> '..') then
begin
ScanDir(Directory + SR.Name + '\');
end;
until FindNext(SR) <> 0;
finally
FindClose(SR);
end;
end;
end;
end;
begin
if trim(Directory) <> '' then begin
if Directory[Length(Directory)] <> '\' then
Directory := Directory + '\';
Files.Clear;
ScanDir(Directory);
end;
end;
Ah wunderbar! hab mal den code von dir in google eingegeben und bin dann auf Delphi-Treff gestoßen.
Bitte auch Quellen angeben - danke!
http://www.delphi-treff.de/tipps/dat...ateien-suchen/