January 6, 2011

Batch Renaming Files (without using the terminal)

So you have a bunch of pictures on your Mac and you want to add a prefix (like say "My Wild Party-") or a date to all of them, or maybe you've already painstakingly renamed them one by one, but want to change the name now. But there are 600 of them. Isn't there any easier way to rename files and folders on the Mac?


You got a Mac because its easy, and powerful. Sure, the biggest geeks will open up Terminal.app and work all kinds of magic. In fact, this is another option for renaming multiple files. But those of us who either haven't the time to dabble in such sorcery or simply want a more Mac-like way are left to different devices.





Enter Automator. Automator lives in the Applications folder on your Mac. Automator exists to automate those boring, time-consuming, repetitive tasks. That's right, you don't need any additional software. It's all there on your Mac already. Automator is made with non-programmers in mind, so you don't have to know any geeky code just to rename your tons of files.


Once you get the hang of it, you'll be using Automator for many of those repetitive tasks you used to do manually. This is a very simple guide to renaming multiple files, or batch renaming, though you can do a lot more with Automator.


Okay, so let's say you've got all those files to rename. First thing you do is launch Automator. Now since Automator is rather open-ended, from this point on there are a lot of ways of going about things. But for simplicity and sanity's sake, I'm going to list only one set of steps to get where we want to go. But you should be aware that there are lots of options here if you want to play around with it later. For reference, I am utilizing Version 2.1.1 (247.1) of Automator.





1. Once Automator finishes bouncing in your dock it's going to be asking you to choose a template for your workflow. The default template, simply titled "Workflow" is fine.





2. If Automator isn't showing the Library, make sure you hit "Show Library" in the toolbar. Once the Library is showing, you'll want to click on "Files & Folders" with the Finder happy face to the left. Once you do that, make sure you select "Get Selected Finder Items" from the list. Using the search bar will narrow down your search. Drag the selection to the area to the right, or just double click it.





3. Look for "Rename Finder Items" and add that. Now the second and final part of our workflow has been added.





4. Now you can hide the Library or expand the window. The first part of our workflow has no options, but the second part is full of them. In this case we will select "Add Text" and "before name". If you wanted to add the text after, you would of course select "after name".





5. Now we write the prefix we want to include before the file names. In this case I want to name some pics we took back at the Appletalker beach party (we had a blast). I am careful to include a space after the dash, but you can select to include an underscore to be more compatible with the net or not include any separation at all if you don't like.





6. Now you have to actually go to the Finder and find the files you want to rename. They can be anywhere. They can be in a folder with other files you don't want to rename. It doesn't matter, because Automator will only touch the filenames of those files you select. Here I've selected my pics.





7. Now we head back to Automator, being careful not to deselect our pics. They should look grayed-out but selected in the background. Now the moment of truth: Hit the Run button at the top right of the toolbar.


Automator may warn you and ask you to make duplicate files. In my opinion, this is a bit overprotective. You're not actually modifying any other attribute of these files except for their file names, something which we do everyday without any need for warnings. If you're incredibly paranoid, go ahead and do it. But take it from me, there's no need to duplicate files and it's just a waste of time and space. And if you're worried about making a mistake, don't worry, I'll show you how to change the file names afterwards.


Automator should display some log information at the bottom pane after completing the task, unless you have the variable display selected, in which case you get a sad nothing displayed. But it should work either way.





8. Congratulations! Your files have now been successfully renamed! And with no extra software or geeky terminal commands.





9. But what if you change your mind about the name? In this case, I've decided to add the year to the end of the title. No sweat. I just take a character I want to put it next to (in this case, I want to put the year before the dash, so I enter a dash), and then I include a space, the year and the dash together, meaning that Automator will replace the dash with the year with a space before for separation and of course, another dash in its place.


You can choose whatever format suits you best, of course. This can get tricky if you have dashes everywhere, for instance. In this case you may have to write out a longer piece of the file name, or the whole text to amend.





10. The file names have now been amended. You see? No need for worry- even if you make a mistake renaming, you can always correct it later, as long as you take some very basic precautions (I don't mess with the original names usually, but if you need to, you might consider Automator's advise and have it duplicate the files beforehand just in case). By the way, if you ever need to simply remove a section of text just replace it with nothing- no space, just make sure there is nothing in the "replace" field and it'll delete whatever text you inserted in the "replace" field.


Afterword


Now if you were paying attention, you noticed that the "Replace Text in Finder Item Names" action has a specific option for adding dates and times. You can do much more complex things than add the year. You can have every file labeled with its date and time of creation in almost any format. The possibilities are vast. But you don't need another tutorial for that. Go ahead and try it out yourself! Automator brings incredible possibilities to the Mac without the need to write one line of code.


Automator will work with almost any Apple app, like the Finder, as we saw, Safari, iCal or Address Book, among others. Apart from Apple apps, Automator can also work with apps like MS Office and Photoshop. Imagine the possibilities! Good luck and have fun! Just remember to backup your data first!


Note: I also published this article at the Appletalker Scrapbook.

0 comments:


Copyright Gamoe.net