procedure TMain.searchfile(apath:string);
var
FSearchRec,DSearchRec:TSearchRec;
FindResult:integer;
f:file of byte;
begin
findresult:=findfirst(Apath+'*.*',faanyfile,fsearchrec);
try
while findresult=0 do
begin
memo1.lines.add(fsearchrec.Name);//用memo存放所有文件名
assignfile(f,Apath+fsearchrec.Name);
Reset(f);
closefile(f);
findresult:=findnext(fsearchrec)
end;
findresult:=findfirst(apath+'*.*',fadirectory,dsearchrec);
while findresult=0 do
findresult:=findnext(dsearchrec);
finally
findclose(fsearchrec);
end;
end;