How to clean up filenames for the web on Mac
Every file gets a clean, URL safe name, spaces and punctuation replaced, extension kept
Intermediate · About 2 minutes
In this guide
What this does
Filenames with spaces, apostrophes, or mixed case tend to cause trouble the moment they touch a website, a URL, or a command line tool. This rule slugifies every filename automatically, turning something like “Final Report (v2).pdf” into a clean, lowercase, hyphenated equivalent, while leaving the extension exactly as it was.
What you’ll build
A rule that matches every real file, then rewrites its name into a clean, URL safe form.
Open the rule editor
This walkthrough happens inside FilesAutomator itself, so install it from the Mac App Store first if you have not already, then open it. In its toolbar, choose Add, then New Automation Rule.
Name the rule and choose a folder
Name it something like “Slugify my filenames for the web” and use Add Folder to choose the folder these files land in, for example wherever you collect files before uploading them somewhere.
Build the condition
Add a single condition: Size is greater than 0. This is a simple way of saying “match any real file,” ruling out only the rare genuinely empty one.

Add the action steps
Step 1: Rename
Choose Add Step, then Rename. In “New name, built from the parts below”, use Add Part, then Transform, then Slugify. On the new chip, choose “the file name” as what it applies to. Add Part again, choose Text, and type a period. Add Part once more and choose Extension.

Turn it on
Select Create Automation Rule, then switch the rule on. Every file that lands here now gets a clean, web friendly name automatically.
A faster way
The template gallery inside FilesAutomator already has this rule ready to install, named Slugify filenames for the web.
Related rules
Get FilesAutomator
Everything in this guide happens inside FilesAutomator itself. Download it free from the Mac App Store to follow along, or to install this exact rule from the template gallery in one click instead of building it by hand.
Download on the App Store