Search and Replace in Select Files Only

I couldn’t figure out what forum to post this question in, so I’ll start here.

Imagine the following folders:

Info/Family/Mammals/
Info/Family/Birds/
Info/Family/Plants/

Imagine that each folder (Mammals, Birds, etc.) contains files named Behavior.php, Reproduction.php, etc. Now suppose I want to replace “this” with “that” - but only in files named Behavior.php. I could target the folder Info/Family, but that would change “this” on files named Reproduction.php as well.

Is there a way to do search and replace operations that only target files with a specific name (or other criteria)?

I’m using Dreamweaver CS3 on a Mac and just discovered Mac’s “Smart Window,” which lets you DISPLAY select files in a Finder window. But I haven’t yet figured out if there’s a way to search those files without searching other files in the same folders. I tried Dreamweaver and TextWrangler with no luck.

Thanks for any tips.

There’s probably a simpler way but what I would do in this case is open up the “Family” folder in finder & in the search bar search for “Behavior.php” - when the search bar appears select “Family” rather than ‘This Mac’.

That should give you all the available Behaviour.php files.

It may be the case that finder is searching inside your php files and returning unwanted files. In this case click the ‘+’ on the right of the search bar. On the drop-down menu change ‘Kind’ to ‘Name’ and enter Behaviour.php.

Open all those files in dreamweaver.

And from memory I believe dreamweaver has a search and replace function - and within that function there’s an option to search and replace all open files.

I can confirm this.
When you open the search and replace dialogue in DW, there is a dropdown menu where you can select “Open documents”