Author: Jonas Bilinkevicius
How to check if a folder contains subfolders
Answer:
1 2 function HasSubDirs(dir: string): boolean;
3 var4 sr: TSearchRec;
5 begin6 result := false;
7 dir := IncludeTrailingBackslash(dir);
8 if FindFirst(dir + '*.*', faAnyfile, sr) = 0 then9 begin10 repeat11 result := (sr.attr and faDirectory <> 0) and (sr.name <> '.') and (sr.name <>
12 '..');
13 until14 result or (FindNext(sr) <> 0);
15 FindClose(sr);
16 end;
17 end;