Question : Unable to Search Empty Folders

Hi, I've got this Code below that I'm using to search for files though it wont do/show anything if the folder is Empty.

I'm really wanting to do something in the function when the folder is empty.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
function SearchFiles(Dir: String): Int64;
var
  sr : TSearchRec;
  FindRes:Integer;
begin
  Result:=0;
  Dir := IncludeTrailingBackslash(Dir);
  FindRes:=FindFirst(Dir + '*.*', faAnyFile, sr);
  While FindRes=0 do begin
    If (sr.Name <> '.') And (sr.Name <> '..') Then
      if (sr.Attr And faDirectory)>0 Then begin
        SL1.Add(Dir+sr.Name);//TStringlists.
        SearchFiles(Dir+sr.Name)
      end else begin
        SL2.Add(sr.Name);//TStringlists.
      end;
      FindRes:=FindNext(sr);
    end;
  FindClose(sr);
end;

Answer : Unable to Search Empty Folders

Could you check it again and give detailed example when it skips empty folders?
Random Solutions  
 
programming4us programming4us