procedure TMainFM.DoLine( Path: String );
var SearchRec: TSearchRec;
Result: Integer;
FC: TStringList;
begin
FC := TStringList.Create;
Result := FindFirst( Path + '*.*', faAnyFile, SearchRec);
while DoIt and ( Result = 0 ) do begin
// Рекурсия папок:
if ( SearchRec.Attr and faDirectory ) <> 0 then begin
if Copy( SearchRec.Name, 1, 1 ) <> '.' then DoLine( Path + SearchRec.Name + '\');
end else begin
if ( ExtractFileExt( SearchRec.Name ) = laExt.Text ) then begin
FC.LoadFromFile( Path + SearchRec.Name );
if Pos( edFind.Text, FC.Text ) > 0 then begin
FC.Text := StringReplace( FC.Text, edFind.Text, edChange.Text, [ rfReplaceAll ]);
FC.SaveToFile( Path + SearchRec.Name );
Inc( FChange );
laChange.Text := IntToStr( FChange );
lbFile.Items.Add( Path + SearchRec.Name + ' [замена]' );
end else begin
lbFile.Items.Add( Path + SearchRec.Name );
end;
Inc( FFind );
laAll.Text := IntToStr( FFind );
lbFile.ItemIndex := ( lbFile.Items.Count - 1 );
end;
end;
Application.ProcessMessages;
Result := FindNext( SearchRec );
end;
FindClose( SearchRec );
FC.Free;
if Path = laPath.Text then DoIt := False;
end;