More Automator: Batch renaming

17Oct08

I work with a lot of files at the Alligator, mostly because our CMS is retarded, but we’d end up having a ton of files either way.

In any case, I find that a lot of times, the photo department doesn’t end up naming the files how I want them — they should be prefixed with yymmdd, where the day is the day we’re producing the paper, not the day the paper comes out. Why it’s like that is a long story, but in any case, I find that I need to rename files en mass a lot.

I’ve tried searching for easy ways of doing this, and it generally comes down to two ways: the command line, or Automator. Once I discovered you could create Finder plugins with Automator, I knew I had my answer. Of course, you won’t always need to rename files the same way, so the big question was whether I could be prompted to input the text I want to replace.

Fortunately, Automator can take input from the user at run time. Check out my workflow:

What this does is get whatever Finder items you have selected (on your Desktop or in a folder), asks you what text you want to replace, and what you want to replace it with. The magic here is selecting “options” on the “Rename Finder Items” pane and clicking “Show this action when the workflow runs.”

Amazingly, that exact pane pops up as a dialog box, meaning you can find and replace whatever you want, whenever you want. If you click “File,” then “Save As Plugin…,” save it as a Finder plugin.

Now, when you want to rename a bunch of files that are misnamed in the same way, select them, right-click (or control-click), go to “More,” “Automator,” and select your plugin. You should then get something like this:

Voila! If you’ve done all of the steps right, you should be renaming tons of files in no time. Don’t thank me, thank Apple for taking some of the pain out of scripting their operating system.

Advertisements


No Responses Yet to “More Automator: Batch renaming”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: