How to rename files by adding them to a folder


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.

Make a Folder Action with Automator in Snow Leopard.

Make a Folder Action with Automator in Snow Leopard.

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

In brief:

  1. Open Automator in Snow Leopard and select Folder Action as what you want to create.
  2. Specify the Folder the Actions will be attached to.
  3. Add Actions to the Workflow.
  4. Save the Workflow.
  5. Add files to the relevant folder.
Set the correct options for renaming your files.

Set the correct options for renaming your files.

Step by Step instructions

  1. Open Automator — it’s in the Applications folder. A window appears where you must choose a type of Automator Workflow.
  2. Choose Folder Action for the Automator workflow type.
  3. Create a new folder inside your Downloads folder — or anywhere on your Mac that you need it.
  4. 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.
  5. In Automator click on Files and Folders in the Library list — This just filters down the available actions in the list to the right of it.
  6. Select Rename Finder Items in 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 Items action appears, with the wrong (default) settings.
  7. Change the settings in the Rename Finder Items action:
    1. Choose Replace Text from the drop-down menu that currently says Add Date and Time.
    2. In the Find box put the text you want to replace. In my example that is .html.
    3. Leave the drop-down menu that says Full Name as it is. You will find .html in the Full Name of the file.
    4. Leave the Replace text box blank. You will find .html and replace it with nothing.
  8. Save the Automator Folder Action — File menu: Save.
  9. 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.
  10. Test the Folder Action: put some files in your special folder. The .html extension 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

  1. Rename a file
  2. Use Get Info to rename a file
  3. Automate It
  4. Rename batches of files

Tell us in the Comments at the website how you use Folder Actions

Related posts

[wpzon keywords="pressure cooker" sindex="PCHardware" snode="1232597011" sort="salesrank" listing="8"]

2 Comments

  1. Miraz Jordan said:

    Thanks Jo. Good to know this was useful.

    I want to explore other Folder Actions too – there were opportunities to resize images, for example, and some very handy possibilities of adding dates and time.

    These Folder Actions are just magic!

    Care to explain how the Evernote Action went?

  2. Jo Fothergill said:

    Hey – great tip – I hadn’t heard about folder actions till the weekend when I set up a folder action to auto-add documents to evernote. This is a great other use for them. (And one to remember next time i need to batch change some file extensions!)

Comments are closed.



Top