procedure TForm1.Button1Click(Sender: TObject); var ss:TSearchRec; filepath:string; begin filepath:='c:\'; listbox1.Items.Clear; if FindFirst(filepath+'\*.txt',faanyfile,ss)=0 then begin if not ((ss.attr and fadirectory)=fadirectory) then listbox1.items.Add(ss.name); while findnext(ss)=0 do begin if not((ss.attr and fadirectory)=fadirectory) then listbox1.items.add(ss.Name); end; findclose(ss); end; end;
var ss:TSearchRec;
filepath:string;
begin
filepath:='c:\';
listbox1.Items.Clear;
if FindFirst(filepath+'\*.txt',faanyfile,ss)=0 then
begin
if not ((ss.attr and fadirectory)=fadirectory) then
listbox1.items.Add(ss.name);
while findnext(ss)=0 do
begin
if not((ss.attr and fadirectory)=fadirectory) then
listbox1.items.add(ss.Name);
end;
findclose(ss);
end;
end;