How to remove all spaces from filenames on Mac
Strips every space from the name, for example Report Final Draft.pdf becomes ReportFinalDraft.pdf
Beginner · About 1 minute
In this guide
What this does
This is the more aggressive sibling of the trailing space rule above, for when you’d rather have no spaces anywhere in a filename at all. It strips every space out of the name, collapsing a run of several spaces down to nothing, so “Report Final Draft.pdf” becomes “ReportFinalDraft.pdf”.
What you’ll build
A rule that matches every real file, then removes every space from its name.
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 “Remove spaces from my filenames” and use Add Folder to choose the folder you want this applied to.
Build the condition
Add a single condition: Size is greater than 0, matching any real file.

Add the action steps
Step 1: Rename
Choose Add Step, then Rename. In “New name, built from the parts below”, use Add Part, then Find and Replace in Name. Turn on “Find is a pattern” and enter this pattern to find:
\s+
Leave the replacement empty. Add Part again, choose Text, type a period, then 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 loses its spaces automatically.
A faster way
The template gallery inside FilesAutomator already has this rule ready to install, named Remove spaces from filenames.
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