Mac comes with a very handy application called Automator, which is useful to automate time consuming repetitive tasks.
Automator is an application which can help you create services and application for your mac. These application and services can be used across the mac and can save a lot of time for the repetitive tasks.
The interface is just drag and drop and you can create some complex tasks with those.
This application has not got its due recognition as it is hidden in the others folder in the launcher.
I like to keep my files organized and many times I found myself in a situation where I need to change hundreds of file names.
This mostly happens with my image folders. If you want to do it manually, it will take some effort.
We will create a service which will ask for the initial prefix and rename all the files in sequential order.
[youtube src=”SHxP5Jd9Lm8″ title=”Rename Multiple Files Through Automator” duration=”T6M18S”]
1. Open Automator and Create New Service
You can open the automator from the spotlight or from Launcher. It should be there in Launcher -> Others folders.
Select the service icon and click on choose. This will create a new service which can be customized to rename multiple files.
2. Select the service input
First thing is that we need to select the input for the service. Since we are trying to rename the folder, we will select Folder in the first drop-down and Finder in the second.
We only want our service to be available in the finder application and that’s the reason we have finder in the second drop-down.
3. Save Folder Path
Because we want to ask user for the prefix, we need to save the path of the input folder.
To do that, create a variable called path. This variable is available under the variable -> Location in the left hand side. You can just drop it in the variable panel.
Now we need to save the value and that can be done with the “set value of Variable” action. Drop the action from Utilities – > Set Value of Variable.
Select the variable Path in the drop down and it will save the path of the folder.
4. Get Prefix From The User
Now we need to get the prefix, which we need to use for the rename operation. To save the prefix we need to create another variable, lets create a variable with the name prefix-name.
Now add a new action “Ask for Text” from Text. You can enter a descriptive message for the users and default value for the input box.
After that add another action “Set value of Variable”, which will take input from the Ask for text action and save it in prefix-name variable.
5. Get Folder Content
Now we have everything what we need to rename multiple files. Lets get the content and rename it.
To get the folder content, we need to take the path variable and get the folder content. Add an action “Get value of variable” from text and select path variable.
After that add another action “Get Folder Content”, this will take the input of the previous action and get the content of the folders.
6. Sort files
This will sort all the files on the old names. This step is necessary as if the files are sorted in any other order it might get wrong names.
To sort all files add an action “Sort Finder Items” and select name and ascending in the drop downs.
7. Rename Multiple Files
Now we have everything ready and we can rename the files.
Add an action”Rename Finder Items” from Files & Folder. Select Make Sequential in the drop down.
Select New Name and add prefix-name in the text box. You can select where you want to place the number and starting point.
Once this is done you can save this service and give it a name. This name will be available in the contextual menu.
Now you can right click on any folder in finder and select the newly created service. This will rename multiple files with the help of Automator service in a single go and will save time for you.
This is an useful app Sanjeev .I never knew such app existed for mac platforms as well. People share software and utilities of windows platform , this is the first post i’ve read about a mac based software .Keep up your good work and thanks for sharing .
-Pramod
Hi Pramod,
Apple does ship this app with the Mac OS but its hidden in utility folders, also it needs some time to get use too.
Its a powerful piece of software which can create some complex services for Mac..I really love the automator as it does lot of blogging work for me…
Comments are closed.