create an Automator Service as in the steps 1 and 2 above.The second task (prefixing the files with a selectable string) is even easier to achieve, using a Standard Automator action: – you will now have a “Remove Prefix” in the Service menu of Finder (and the context menu of files and folders) which will rename files so a numerical prefix followed by an underscore is stripped from the file name. Save to the default location as “Remove Prefix”. – see the Bash Reference Manual’s chapter on Pattern Matching for an explanation of how this works (recommended reading for this kind of operation anyway :)). Insert the following code: shopt -s extglob add a “Filter Finder Items” action and set it to filter on the condition “none” match “kind is Folder” to make sure you have only files.Īdd a “Run Shell Script” action and make sure it runs /bin/bash and takes its input “as arguments”.
Set it to take “Files or folders” as input. Your first task (removing a numerical prefix followed by an underscore form file names) can be solved like this: There is no need for dedicated file renaming software to do such relatively simple batch renaming operations – Automator will allow you to create services that do what you want.