Home > News Tips

Use Automator to Rename Files & Rename Multiple Files at Once

Updated on Tuesday, December 3, 2024

iBoysoft author Yvonne Feng

Written by

Yvonne Feng
Professional tech editor

Approved by

Jessica Shee

English Français Deutsch やまと Español Português

Summary: This article guides you on how to use Automator to rename files. From this post, you can learn about the methods to use Automator to rename files, batch rename files, as well as rename multiple files at once. - From iBoysoft

summary-use-automator-to-rename-files

Automator, an automation tool comes with macOS to help you create automated workflows that reduce repetitive tasks and increase productivity. You can use Automator to rename files on Mac, change file extensions, rename files from Excel lists, open a website, etc. 

Today, we will guide you on how to use Automator to rename fileshow to batch rename files, and how to rename multiple files at once are explained.

How to use Automator to rename files?

Automator helps you create automated workflows that perform common tasks in batches, including file renaming. Here are the detailed steps to use Automator to rename files.

  1. Open Automator (Finder > Applications or through a Spotlight search).
  2. Once Automator is open, click the File menu and select New. In the dialog box that pops up, select Workflow and click Choose. 
     select-workflow-click-choose
  3. Select the file you want to rename. In the left sidebar of the Automator window, locate and select Get Specified Finder Items and drag it to the workspace on the right. Then click the Add button and select the file you want to rename. 
    get-specified-finder-items 
    Hold down the Command key and click multiple files if you need to batch rename files. To rename a folder, add Get Folder Contents in the action bar. This way, the Automator will automatically process all files within the folder.
  4. In the left panel, find the Rename Finder Items action and drag it below Get Specified Finder Items in the workflow area. Automator will ask if you want to Copy Finder Items to avoid overwriting your originals. Choose Add to make a copy or Don't Add if you're okay modifying the original files.
     copy-finder-items-option
  5. Set up your rename rules. The Rename Finder Items action provides several renaming options. Please select the one that works best for you. For example, if you want to add "_RGB" to all files, choose Add Text and enter "_RGB" as the suffix. 
    set-up-rename-rule
  6. Run the Workflow. In the upper-right corner of Automator, click Run to execute the workflow. Automator will automatically rename all selected files based on the settings you have set up.
  7. Save the Workflow. If you plan to use this renaming workflow again, save it as either a Workflow or an Application: Go to File > Save, give your workflow a name, and choose a location to save it.

If you save it as an Application, you can drag files onto the app to execute the renaming automatically. If saved as a Workflow, you can open it in Automator to run it anytime.

Share the method to use Automator to rename files with your friends!

 

How to rename multiple files at once with different names? 

Rename multiple files through Finder

  1. Open Finder 
  2. Select the files you want to rename. (hold down the Command key and click multiple files)
  3. Right-click on the selected files and choose Rename from the menu.
  4. Select Format or Replace Text. The default batch renaming allows you to apply a uniform name. 
    finder-format-replace-text 
    If you need to set a different name for each file, you can press the Return key or double-click the file name to edit it, then enter the desired name for each file. Then, renaming multiple files at once can be achieved.

Rename multiple files using Automator with a name list 

If you need to rename several files with unique names, Automator can help by using a name list. Here is how to use Automator to rename files with different names.

  1. Prepare a name list. Use a text editor like TextEdit or Excel to create a .txt file on Mac. Write the desired names in separate lines, one name per line. 
  2. Open Automator. Applications > Automator and create a new Workflow.
  3. Add files to Automator. Add the action Get Specified Finder Items. Drag and drop the files you want to rename into this action.
  4. Set up a Loop. Add a Loop action from the left panel, and set the loop to match the number of files.
     add-loop-action
  5. Load the name list. Use a script (e.g., AppleScript) within Automator to read the .txt file. Apply each name from the file to a corresponding file. You can search Run AppleScript in Automator and drag it into the action. Type the following command into AppleScript: 

    on run {input, parameters} 
       -- Get the path to the name list file 
       set nameListFile to POSIX path of (choose file with prompt "Select the name list file") 

       -- Read the name list and split into lines 
       set nameList to paragraphs of (read file nameListFile) 

       -- Rename files based on the name list 
       repeat with i from 1 to count of input 
           set thisFile to item i of input 
           set thisName to item i of nameList 
           tell application "Finder" to set name of thisFile to thisName 
       end repeat 

       return input 
    end run

  6. Run the Workflow. Automator will process the files and rename them based on the name list.

Share this post if you find it insightful.