Automator script to rename files on Mac OS X [closed]
Asked Answered
B

2

5

Is there an easy way to use Automator on OS X to replace spaces in filenames with underscores?

Balky answered 2/11, 2009 at 18:56 Comment(1)
You should be able to shell script something like this and run it from the command lineBobbe
C
9

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:

  1. launch Automator

  2. when prompted, choose the "Service" template.

  3. 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)

  4. 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)

  5. 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.

  6. 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")

  7. 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"

  8. 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.

Cropper answered 19/1, 2011 at 16:33 Comment(5)
Thanks. Finally got around to use the Automator in a proper and really useful way. I find myself often renaming heaps of files, like 50 in a go. Saves me endless of time. Have a beer.Zwieback
Glad to help. I hardly ever need to do this sort of thing, but when I do, this service has saved me heaps of time. I'm always amazed at how fast it runs too.Cropper
Being able to add whatever renaming convention I want to my right-click menu for files and folders is incredible! Thanks!Philina
Technical note: there is a limit of exactly 1000 files that can be multi-selected and renamed in one batch with Automator.Philina
How to get prompted for name to rename? ;)Valorize
D
-2

I am another one that has never used Automator,and quite a lot of people say it`s easy to use. Judging by the above tutorial i find that very hard. I am 64 years old,not technically minded,and to tell you the truth i would still prefer to do it manually.I have getting by all the time the same has a lot of people that do not evan mention it,and have never used it at all the same has me?

Davisdavison answered 22/3, 2013 at 19:14 Comment(1)
Unfortunately, when you start doing things that are "technical" on your computer, it can be an issue. Some systems will see spaces as separators between different entities. They will understand "Amazing Title.mpg" as two separate things -- "Amazing" and "Title.mpg". Calling it "Amazing_Title.mpg" makes sure that this confusion doesn't happen.Tremain

© 2022 - 2024 — McMap. All rights reserved.