Советы по Delphi

         

Поиск на винчестере


Я ищу метод или компонент, производящий поиск каких-либо файлов на винчестере, например, (*.exe)...

    unit Audit1;
interface
uses
windos;

var
dest:string;
procedure dorecurse(dir:string);

implementation


{$R *.DFM}
Procedure Process (dir:string; Searchrec:tsearchrec);
begin
showmessage (Searchrec.name); case Searchrec.attr of $10: if (searchrec.name<>'.') and (searchrec.name<>'..') then begin dorecurse (dir+'\'+searchrec.name); writeln (dir); end; end; end;

Procedure Dorecurse(dir:string);
var
Searchrec:Tsearchrec; pc: array[0..79] of Char;
begin
StrPCopy(pc, dir+'\*.*'); FindFirst(pc, FaAnyfile, SearchRec); Process (dir,SearchRec); while FindNext(SearchRec)<>-18 do begin Process (dir,SearchRec); end; end;

Procedure startsearch;
begin
dorecurse (paramstr(1)); end;

begin
startsearch; end.

[000126]



Содержание раздела