unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var rek:TSearchRec;
    ile_plikow:integer;
begin
   Label1.Caption:='';
   ile_plikow:=0;
   if FindFirst('Unit1*.*', faAnyFile, rek) = 0 then
   begin
      repeat
        ile_plikow:=ile_plikow+1;
        Label1.Caption:=Label1.Caption+rek.Name+' '+IntToStr(rek.Size)+' bajtów'+#13;
      until FindNext(rek) <> 0;
      FindClose(rek);
    Label1.Caption:=Label1.Caption+'Liczba plików Unit1*.* wynosi '
                    +InttoStr(ile_plikow);
   end;

end;

end.
