How to automatically rename downloaded files on a Mac

Automator holds the key

Mac files

Here's what to do when your downloaded Mac files start changing their names all by themselves.

Question

I use the Outlook Web app to access my company's Exchange email and to download work file attachments. When I do so, they download correctly, but the file names have "%20" in the places previously occupied by spaces in the file name. It is very time consuming to fix this manually. Is there any way to prevent this in the first place?

Answer

When downloading files online, the "%20" is a web standard to replace the spaces in words and phrases. The best way to prevent this by only uploading files with underscores ("_") instead of spaces. However, with a little Automator action, you can completely rid yourself of these issues with some on-the-fly renaming of files when they are added to the Downloads folder.

Untitled

In Automator, follow these steps:

1. In the template chooser, select Folder Action.

2. In the "Folder Action receives files and folders added to" drop-down menu, select the Downloads folder.

3. Find the "Get Folder Contents" action in the pane to the left, drag it into the workflow, and check its option for "Repeat for each subfolder found."

4. Add the "Rename Finder Items" action into the workflow underneath the previous action. When prompted, choose not to add the Copy Finder Items action as well, then set the action's options to "Replace Text", and set "Find" to "%20" (without the quote marks), "in full name," and put a space in the Replace field.

5. Save the action by pressing Command + S, then specifying a name.

Each time a file is added to the Downloads folder, this action will run, and it will automatically rename files with names containing "%20" to use spaces instead.