Search and Replace at the Finder Level


Text editors are great if for no other reason than that you can execute a search and replace function. This little tool has saved me countless hours of tedious, mind-numbing text replacement exercises. But what happens when you need to alter several items outside of a text editor? Say, files in the Finder…

Ok, here’s what lead me to our discussion today:
When I post my family photos to the internets, I use SlideShowPro. When I’m prepping my images for viewing through the SlideShowPro interface, I scale them down so they load quicker. Any long-time reader here will be anything but surprised to find that I use Quicksilver to quickly process whatever size batch of photos I’ve got. Quickly, here’s how:


The result of Quicksilver’s scaling action however, duplicates my original image files and adds a ‘ 1’ before the file extension. So now I’ve got say, 25 files that I need to have their names cleaned-up. While it’s easy, it’s a bit tedious – especially when I know there’s better way of doing it…

Enter Apple’s Automator. This app really is awesome, and I don’t utilize it nearly enough. But I launched it and within about 5 minutes I had a working solution, specific to my problem. Here’s what that looked like:


So I ran it and it did just what I wanted. Brilliant! I love when a plan comes together.

It needed a couple of tweaks though. I’d rather select the items and then initiate the script, rather than the other way around. So I changed that. I also realized that it’s not very efficient having such a specific search and replace script when I may have different needs in the future. A quick tinker (expand the Options on the rename step, and check the ‘Show Action when run’) and my result was this:

optional setup

When it runs, here’s how it looks:

workflow in action

You can save this Automator script to the Scripts folder, which you may have accessible from the menu bar, but I’ve gotta tinker a bit more. So I instead saved the workflow as a plugin (look for it under the File menu) for the Finder. So now all I do is select the files I want to do a search and replace on, right click (ctrl + click) the selection, and choose Automator->replaceScript. It’s that simple.


Eddie Hargreaves

A similar AppleScript is available in the Script Menu called “Replace Text in Item Names”

And there was a pre-installed script I brought over from my OS 9 Mac called “Replace Text in Selection Names”

Nick Santilli

You guys are right – and I considered these points as I wrote it. But I thought the find & replace was generally more useful as a tool for the public than a specific workflow just for my needs. Thus, I chose to just hit it from that angle.

However I’m not that well versed with Automator, so I may be tapping some of you as I try different things with it in the future.



If you’re going to use Automator, you might as well scrap Quicksilver altogether and just use Preview’s scale action. QS is easier of course but then you need to rename the files. To use both apps is an increase in time taken, anyway.

Your best bet would be to go:
Get Selected Finder Items -> Scale Images (Show action when run).

This way, you don’t need to use Quicksilver at all – just run the plugin to scale your apps. And as Paul mentioned, you add a Copy Files action if you want to preserve the originals.

Sometimes the simplest way is simpler than just simple (if that makes sense).


Or you can cut it down to one step with an automator action that copies the selected files to a new location of your choosing and then scales those copies down to a resolution of your choosing, names unchanged.

Richard Neal

How about setting it up as a folder action, so the script would run automatically, no questions asked, when the pictures appeared with 1.jpg in their name, and still keep the plugin for other usage?

Comments are closed.