How to check if a folder contains subfolders (Views: 714)
Problem/Question/Abstract: How to check if a folder contains subfolders Answer: function HasSubDirs(dir: string): boolean; var sr: TSearchRec; begin result := false; dir := IncludeTrailingBackslash(dir); if FindFirst(dir + '*.*', faAnyfile, sr) = 0 then begin repeat result := (sr.attr and faDirectory <> 0) and (sr.name <> '.') and (sr.name <> '..'); until result or (FindNext(sr) <> 0); FindClose(sr); end; end; |