Clean File Names with Automater

Posted February 18th @ 3:53 pm  |  Filed in: OS X    

Every web developer knows how it goes - now matter how many times you tell your clients not to includes spaces, slashes, etc. in the files they want posted on their website, they do it anyways - it’s part of the deadline-driven work flow. Let’s take a basic look at how to fix this easily and quickly using OS X and Automator.

Automator to the Rescue!

ottoApple’s Automater is a handy, built-in too that allows you to create “workflows” that would normally be time-consuming both to do, and to program a solution for. Need to rename a bunch of files, and copy them to another directory? Change a slew of file extensions? Make thumbnails out of a bunch of images? Encrypt your PDFs? Sure, you could write some Python/Ruby/Shell script to handle this. But, just about any tedious file-related task you can think of can be handled by Automator, and better yet, easily created using a friendly drag n’ drop interface. For more details, MacDevCenter has a great introduction on this. But generally, Automator is so easy to use, you can just figure it out as you go.

Along these lines, I was originally going to demonstrate my own “clean file name” action and how to create it, but after checking Apple’s website, somebody already created a nifty looking one called Make Names Web-Friendly - and it looks really cool. Download it, run the installer, and you’re ready to go. Let’s test it out on the following file name:

Some - stupid / file & name.txt

The easiest way to access our new tool is to right-click the file, and select:
More -> Automator -> Make Names Web-Friendly:

right-click to access the action

Next we are presented with a dialog box, asking how to handle various symbols:

web-friendly in action

I changed the “Convert spaces to” option from underscores to dashes (since the file name used a dash already), and clicked Continue. Viola! Our crummy filename is now nice and clean, and will not break any URL it’s used in:

some-stupid-file-and-name.txt

But Wait! There’s More!

There’s a whole slew of free and wonderful Automator Actions on the Apple website. So before you try to build your own, best wander over there and see if somebody already did it for you - I learned my lesson!

No Comments Yet

You can be the first to comment!

Leave a comment

OpenID Login

Standard Login

Options:

Size

Colors