Batch Rename Files with Automator

Admit it. Your files are ugly.

For sure, they’re filled with sexy spreadsheets, beautiful photos, and groundbreaking prose, but their names are repulsive.

Files come to you from all corners of the office, applications dump files inpenetrable names generated via algorithm, and sometimes even contain characters that will make them invisible on other machines. What’s an Empowered User to do?

You could painstakingly rename each file you come across, or you could fix issues in big batches. One sees the problem as rock wall to be chipped away with uncountable swings of the pickaxe. The other sees the problem as an opportunity for dynamite.

Let’s get you set up with some high explosives.

What You’re Doing

You don’t need to spend any more of your life or brain messing around with file names. Today you’re going to give yourself the ability to eliminate this nusaince. Whether it’s with 2 or 2000 files, you’re going to learn to do the following:

  • Rename files as parts of a sequence
  • Change the case of existing file names
  • Replace text in existing file names

You can do all this with one tool and it’s already on your mac…

Automator: The Most Powerful App You Didn’t Know You Had

Part of the core apps of MacOS, Automator is Apple’s noble effort to hand users a graphical automation utility that doesn’t rely on knowledge of programming or scripting.

Otto the Automator

Otto the Automator

Automator will execute batch operations like converting or scaling images, combine PDF pages, add special actions to your right click menu like a character counter, or automate actions for folders.

Apple doesn’t show automator the same love as it does it’s other core apps like Mail, Notes, or Safari (I mean check out the official Automator website), but its usefulness is in no way diminished by that.

Stick around this blog long enough and eventually you’ll learn a lot more cool Automator tricks, but as always, a big opaque app like Automator is best tackle with baby robot steps.

Creating The Basic Workflow

Open up Automator either by going to /Applications/Automator or just doing a Spotlight search for it.

The first screen asks you what kind of automation you’d like to create. Choose “Workflow”. A workflow is a process that’s run inside automator. It makes it easier to tweak and debug.

Choose workflow on Automator new document screen

After you choose workflow, you’ll see the following screen.

Layout of Automator workspace

Automator is based on stringing together “Actions”. Find these “Actions” in the “Actions” panel to the left. Drag desired “Actions” into the “Workspace” on the right.

PRO TIP: Poke around in here. Don’t worry about not understanding all of it, you’ll probably only get a small fraction of what you see and that’s totally fine! If you get 1% of what you see, then you’ve learned about a possibility you didn’t know about before

You’re ready to begin contstructing your workflow.

Action 1: Get Specified Finder Items

This action will allow you to drag the desired files and/or folders into the workflow to be worked on by the next action.

You can find “Get Specified Finder Items” in the “Files & Folders” category in the library or just search for “Get Specified Finder Items”.

Once you’ve got it, just click and drag the action into the workspace.

Finding the "Get specified Finder Items" action

Action 2: Rename Finder Items

This action gives you a variety of different options for how to rename the items that you supply it with an action like “Get Specified Finder Items”.

Again, find it in the “Files & Folders” category or search for it by name.

Finding the "Rename Finder Items" action

Configure the Rename Rules

Now comes the fun part. The “Rename Finder Items” actions is very versatile and powerful. The following examples are all acheived with this template workflow and tweaking the “Rename Finder Items” action.

Awesome Use #1: Make File Names Sequential

Let’s say your phone automatically copies photos to the Camera Uploads folder on Dropbox. To save disk space, you pack the month’s photos into a new folder, rename them, and unsync them from your computer. To rename them in the fashion, “October 1, October 2,…” you would configure “Rename Finder Items” like so.

  • Click on the dropdown that says “Add date or time” and change its option to “Make Sequential”
  • Select “New Name” and specify whatever you want
  • Choose where you want the number to appear, before or after the name
  • Select the separator between the file name and the number (dash, period, space, underscore, nothing)

Image

Fire it Up

With your options properly set, you’re ready to go!

Drag the desired files into the “Get Specified Finder Items” action window, or click the “Add” button and find the files you want.

To run the workflow hit the “Run” button up on the top right of the toolbar and prepare to have your socks blown off.

Did you have flashbacks to times you went file by file through an endless folder of event photos? Did you feel a swell of anger that you didn’t know about this before? Don’t worry, this feeling is normal.

Rad Use #2: Finding and Replacing Text

My old boss had an annoying (to me at least) habit of using underscores instead of spaces in his files. Clearly “Rhode_Island_ACS_2015” is an affront to all that’s decent. Luckily, the “Rename Finder Items” can handle stuff this.

Change the rename option to “Replace Text”, then fill in the find and replace values you want. In this case, simply finding an underscore and replacing it with a space.

Image

Dope Use #3: Changing Case

Again, I’m very particular (fussy) regarding how file names look. I don’t like ALL CAPS and I don’t like when proper nouns and names aren’t capitalized, which is why I get a lot of mileage out of the “Change Case” function of “Rename Finder Items”. It can do three things to your file names:

  1. lowercase: obvious
  2. UPPERCASE: obvious
  3. Title Case: capitalizes the first letter of each word

After showing this to people, I often hear that they use it to clean up long lists of team photos.

Conclusion

Automator aspires to bring complex automation to the regular user. I feel it is too opaque to actually achieve this, but around here on the Empowered User, we don’t expect any person to be perfect and we don’t expect any software to either. Automator does a few accessible things very well and for that we should cherish it.

If you use Automator for nothing else but batch renaming, then you’re using it to save yourself precious time and brain power. There’s oh so much more to be done with it, and together we can discover what those are.

Leave a Reply