How to rename files by adding them to a folder
Mac Tip #438, 26 May 2010
Would you like your Mac to automatically make changes to files when you add those files to a folder? Folder Actions is what you need — available through Automator. Here’s how to make a Folder Action to rename files.
An attachment name problem
A client’s webmail added
.html to the end of all attachment names — even MS Word files or PDFs. She was unable to open any attachments until she manually renamed the files. This wasted time and was annoying.
Rename files automatically
I’ve written several Tips over the years about how to manually rename files on a Mac. The articles are listed at the end of this Tip. All those methods require you to actually do something though.
How about if the file names changed by themselves as they arrived in a folder? That’s what a Folder Action can do for you.
A Folder Action is one or more actions triggered by adding a file to a folder. There are many possibilities including renaming, zipping, moving to another folder, resizing images, and so on.
How to make a Folder Action
- Open Automator in Snow Leopard and select
Folder Actionas what you want to create.
- Specify the Folder the Actions will be attached to.
- Add Actions to the Workflow.
- Save the Workflow.
- Add files to the relevant folder.
Step by Step instructions
- Open Automator — it’s in the Applications folder. A window appears where you must choose a type of Automator Workflow.
Folder Actionfor the Automator workflow type.
- Create a new folder inside your Downloads folder — or anywhere on your Mac that you need it.
- In Automator choose that folder for the Folder Action to apply to — from the drop-down menu in the top right corner of the window.
- In Automator click on
Files and Foldersin the Library list — This just filters down the available actions in the list to the right of it.
Rename Finder Itemsin the list of actions and drag it into the work area on the right. An alert appears asking about duplicating the files. Choose
Don't Add: you don’t need to keep backup copies of these files — you’re only changing the name. The
Rename Finder Itemsaction appears, with the wrong (default) settings.
- Change the settings in the Rename Finder Items action:
Replace Textfrom the drop-down menu that currently says
Add Date and Time.
- In the
Findbox put the text you want to replace. In my example that is
- Leave the drop-down menu that says
Full Nameas it is. You will find
Full Nameof the file.
- Leave the
Replacetext box blank. You will find
.htmland replace it with nothing.
- Save the Automator Folder Action — File menu: Save.
- Give the Folder Action a name — the actual name doesn’t matter — and click Save. You can’t choose where to save this Folder Action — the Mac just puts it in the right place.
- Test the Folder Action: put some files in your special folder. The
.htmlextension should just magically disappear.
Download a PDF
The steps are all detailed with a large screenshot for each step in How to rename files by adding them to a folder (1.7Mb PDF). Download for free.
How to rename files on a Mac
Tell us in the Comments at the website how you use Folder Actions