n: integer; procedure Find; Var SearchRec: TSearchRec; begin GetDir(0,cDir); if cDir [length (cDir) ] <> 'V' then cDir := cDir+’\ ’; if FindFirst(FileName, faArchive,SearchRec) = 0 then repeat
172
if (SearchRec.Attr and faAnyFile) = SearchRec.Attr then begin Forml.Memol.Lines.Add(cDir + SearchRec.Name); n := n + 1; end; until FindNext(SearchRec) <> 0; if FindFirst('*', faDirectory, SearchRec) = 0 then repeat if (SearchRec.Attr and faDirectory) = SearchRec.Attr then begin if SearchRec.Name[l] <> '.' then begin ChDir(SearchRec.Name); Find; ChDir('..'); end; end; until FindNext(SearchRec) <>0; end; function GetPath(mes: string):string; var Root: string; pwRoot : PWideChar; Dir: string; begin Root :="; GetMem(pwRoot, (Length(Root)+l) * 2); pwRoot := StringToWideChar(Root, pwRoot, MAX_PATH*2); if SelectDirectory(mes, pwRoot, Dir) then if length(Dir) =2 then GetPath := Dir+'\' else GetPath := Dir else GetPath:= "; end; Procedure TForml.ButtonlClick(Sender: TObject); begin Memol.Clear; Label4.Caption := "; FileName := Editl.Text; cDir := Edit2.Text; n:=0; ChDir(cDir); Find; if n = 0 then ShowMessage('Shartga mos keluvchi fayllar yo‘q.') else Label4.Caption := 'Fayllar soni:' + IntToStr(n); end;