uses
 Dos;

var
 SR: SearchRec;
 F: file;

begin
 MkDir ('TESTDIR.TTT');
 MkDir ('TSTDIR');

 Assign (F, 'TstFile1');
 Rewrite (F, 1);
 Close (F);

 Assign (F, 'TstFile2.tst');
 Rewrite (F, 1);
 Close (F);

 WriteLn ('All items matching ''*'':');
 FindFirst ('*', Directory, SR);
 while DosError = 0 do
 begin
  Write (SR.Name);
  if SR.Attr and Directory = Directory then
   WriteLn (' - directory')
  else
   WriteLn (' - file');
  FindNext (SR);
 end;
{$IFDEF FPC}
 FindClose (SR);
{$ENDIF FPC}

 WriteLn ('All items matching ''*.*'':');
 FindFirst ('*.*', Directory, SR);
 while DosError = 0 do
 begin
  Write (SR.Name);
  if SR.Attr and Directory = Directory then
   WriteLn (' - directory')
  else
   WriteLn (' - file');
  FindNext (SR);
 end;
{$IFDEF FPC}
 FindClose (SR);
{$ENDIF FPC}

 RmDir ('TESTDIR.TTT');
 RmDir ('TSTDIR');

 Assign (F, 'TstFile1');
 Erase (F);

 Assign (F, 'TstFile2.tst');
 Erase (F);
end.
