procedure SearchAllFile(DirName: String; Files: TStrings);
var
fpath: String;
sr: TsearchRec;
begin
fpath:=DirName+'/*.*';
if FindFirst(fpath,faAnyFile, sr)=0 then
repeat
if (sr.Name <> '.')and(sr.Name <> '..') then
begin
if (sr.Attr and faDirectory)=faDirectory then
SearchAllFile(DirName+'/'+sr.Name, Files)
else Files.Add(DirName+'/'+sr.Name);
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SearchAllFile('C:/demo', Memo1.Lines);
end;