Is there an easy way to use Automator on OS X to replace spaces in filenames with underscores?
In the Shortcuts app on your Mac, do either of the following: Double-click a shortcut, select the name of the shortcut at the top of the shortcut editor, enter a new name, then press Return. Select a shortcut, choose File > Rename, enter a new name, then click Done.
I've set up a service called "Rename Items…" that can be run by selecting any item (or batch of items) in the Finder, right clicking, and then selecting Services > Rename Items…
This is useful as it will provide a small popup window when you perform the action, where you can choose whatever settings you want (for example, you can make the sequence sequential, replace text, add text, etc.)
In order to create something similar for yourself:
launch Automator
when prompted, choose the "Service" template.
drag and drop the Rename Finder Items action to the workflow area on the right (you can find this action easily by typing 'rename' into the search bar in the upper left of Automator)
you will be asked whether you want this service to duplicate files when they are renamed (preserving the originals) or just work on the files themselves (if you do this, your actions will not be undo-able)
configure the action to whatever you want the default prompt to be ("Add Date or Time", "Add Text", "Change Case", etc.) I have selected "Make Sequential" as my default, but you can do whichever you prefer.
At the bottom of the action bubble, there are 3 small buttons (Results, Options, Description). Choose Options, and then tick the box that says "Show this action when the workflow runs")
Lastly, at the top of the Automator window, you must configure two dropdowns that specify what this Service will be active for. Set this to: "Service receives FILES OR FOLDERS in FINDER.APP"
Save and you're done. Select any file in the Finder now, and under the Services menu you will find your new service (under whatever name you gave when saving, eg. "Rename Items…") Whenever you run this service, you will get a popup window that allows you to configure your renaming pattern.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With