(Gast)
n/a Beiträge
|
Re: Prüfen ob Ordner, Unterordner hat
26. Apr 2006, 14:31
Hallo,
das wird Dir helfen:
Delphi-Quellcode:
//Unterverzeichnisse eines bestimmten Verzeichnisses einlesen
procedure GetSubDirs(const sRootDir: string; slDirectories: TStrings);
var
srSearch: TSearchRec;
sSearchPath: string;
slSub: TStrings;
begin
Screen.Cursor := crHourGlass;
slSub := TStringList.Create;
slDirectories.BeginUpdate;
try
sSearchPath := sRootDir;
if FindFirst(sSearchPath + '*', faDirectory, srSearch) = 0 then
repeat
if ((srSearch.Attr and faDirectory) = faDirectory) and
(srSearch.Name <> '.') and
(srSearch.Name <> '..') then begin
slDirectories.Add(sSearchPath + srSearch.Name);
slSub.Add(sSearchPath + srSearch.Name);
end;
until
(FindNext(srSearch) <> 0);
FindClose(srSearch);
finally
slDirectories.EndUpdate;
FreeAndNil(slSub);
Screen.Cursor := crDefault;
end;
end;
|
|
Zitat
|