function ListFiles(Dir: String):TStrings;
var
FSearchRec: TSearchRec;
FileList: TStrings;
FindResult: Integer;
begin
if Dir[length(Dir)]<>'\' then Dir:=Dir+'\';
FileList :=TStringList.Create;
FindResult:=FindFirst(Dir+'*.ini',faAnyFile+faDirectory,FSearchRec); //只历遍INI文件类型
try
while FindResult = 0 do
begin
//FileList.Add(LowerCase(Dir+FSearchRec.Name)); //历遍后显示文件路径DIR+文件名FSearchRec.Name
FileList.Add(LowerCase(FSearchRec.Name)); //历遍后只显示文件名FSearchRec.Name
FindResult:=FindNext(FSearchRec);
end;
finally
FindClose(FSearchRec);
end;
ListFiles:=FileList;
end;
//-------------------------------------------------------------------------
procedure TForm1.btn1Click(Sender: TObject);
var
a:TstringS;
i:Integer;
begin
a:=TStringList.Create();
a:=ListFiles('F:\验证系统\Porject\');
for i:=0 to a.Count-1 do mmo1.Lines.Add(A[i]);
end;