Hi,
so kann man es machen, läuft mit ShellAPI:
Delphi-Quellcode:
interface
procedure DirSearch(SearchDir, SearchFile : string;
var DirList, FileList : TStringList);
implementation
procedure DirSearch(SearchDir, SearchFile : string;
var DirList, FileList : TStringList);
var
i : Integer;
SearchRec : TSearchRec;
begin
if SearchDir[Length(SearchDir)] <> '\' then SearchDir := SearchDir + '\';
i := FindFirst(SearchDir + SearchFile, faDirectory, SearchRec);
if DirectoryExists(SearchDir)
then DirList.Add(Copy(SearchDir, 0, Length(SearchDir) -1));
while i = 0
do begin
if (SearchRec.Name <> '.')
and
(SearchRec.Name <> '..')
then begin
if DirectoryExists(SearchDir + SearchRec.Name)
then DirList.Add(SearchDir + SearchRec.Name);
if FileExists(SearchDir + SearchRec.Name)
then FileList.Add(SearchDir + SearchRec.Name);
SearchRec.Name := SearchDir + SearchRec.Name;
DirSearch(SearchRec.Name, SearchFile, DirList, FileList);
end;
i := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
Der Parameter fa.... gibt den Filetyp an, also z.B. alle Files (faAnyFile) oder nur Dir's (faDirectory).
Ich hoffe geholfen zu haben.
Gruß Michael