How to Rename Files With Automator

Automator is an application bundled with OS X for quite a few versions now, but it is often misunderstood and used even less. At its core, Automator is a basic scripting application that allows you to stack those scripts together with drag-and-drop simplicity, giving you a powerful tool to fight repetition and busy work; getting more done with less work.

Getting into Automator can be a little scary, which is why we started you off with a simple yet effective use of it. There are applications out there you can purchase to rename files en masse, or you can use the software that came for free with your OS. Here is how to use Automator to rename files in OS X.

Setting the Workflow Up

This is probably one of the easiest and most effective uses of Automator for a beginner. We all have files that would use a good batch rename, and this can help get that done. Whether you want to give all your vacation pictures the same prefix, or you want to update all those screen shots for your project to look more professional, Automator has you covered, here’s how.

First things first, you need to open up Automator (Applications > Automator) and start a new Workflow, then click Choose.

Next, drag the following items out of the full list of Actions into the Workflow Space:

Get Specified Finder Items

Rename Finder Items

Once you’ve dragged each of these over, it should look like this:

A warning box will come up when you try to add the Rename Action. This is asking if you want a copy of the files being renamed made, or if you wish to rename the originals. For the sake of this tutorial we’ll be renaming the originals.

The first action listed above is how you find the files you want to batch rename, and the second item is the piece that does the actual renaming work. You need both for this to work, otherwise Automator won’t know what files you’re looking for.

You can now adjust the Rename Finder Items Action to get the exact name you’re looking for. Let’s say for example you want to completely change the filename of screen shots from having the date and time to instead use the name of the project you’re working on and have sequential numbers. This means instead of this:

You would have this:

While it’s easy to do this to a few files yourself, what if you have 100? What about 1,000? Getting Automator to do this is easy. Update the settings of the Rename Finder Items Action to the following:

This will completely replace the existing file name with the new name added above. This could be vacation-pics-2013 or Work Conference Vegas. Whatever you type here will be the new name of all the files. After this name Automator will now add sequential numbers. You can enter the number you want to start with, and how you want the number separated. Once you change these settings to be what you want, it’s time to test the workflow out.

Testing It Out

In the Get Specified Finder Items Action click the Add… button and select the files you want to rename.

Note:This current workflow will not look in folders, but will instead treat folders as files to rename. There is a way to get the workflow to look in folders, but for now, make sure you only add individual files here.

Once you add the files, it should look similar to this:

With the Finder items added, it’s time to run the workflow. Since we’re just testing it out, I’d recommend taking a few random screen shots or making a copy of your files to test with, just in case you made a mistake. Click the Run button in the top right corner of the window.

Once the workflow runs, you should see all green checks in the Log at the bottom of the screen. If yours isn’t all green like the example below, then something went wrong and you need to check your workflow out again.

When you’re done, your files should all be renamed. Using this method, the files will be named sequentially in the order they were added to the Finder Items window.

Once you’re happy with the results, it’s time to save the Workflow.

Saving Your Workflow

When you have your workflow set up just how you want it, click the File menu, then Save. This will bring up the Save dialog box. Enter a descriptive name, then you have an option. If you plan on changing anything in this workflow later, like the base name or the numbering, save it as a Workflow. If it’s done and set, save it as an application.

Either way you can use it to rename files, but if it’s saved as an application, you can actually drag and drop files onto the application icon to process a rename. This is great for processing files on the fly. Just leave the new application on your desktop and drop files on it any time you want to rename them.

If you save as a Workflow, you can’t drop files onto the icon, but when you double-click the saved Workflow, it will open in Automator.

Wrap-Up

This is just one way to use Automator. There are thousands of possible workflows, giving you more control over your files and computer than you could probably ever use. Play with the different rename settings but remember if you use the Replace Text feature, that this will look in the basename as well as the extension for each file. It’s recommended that you look in basename only unless you’re purposely trying to alter the file extension.

About Brian Meyer

Brian is a technology nut who loves all things Apple. Along with tech blogging he owns and operates a website dedicated to Craft Beer knowledge and information: Craft Beer Academy. With a love of sharing information and finding the newest tech out there, he is a great source for interesting news and instruction.