macOS Hidden Treasures: Batch-Rename Items in the Finder

You do need to activate it yourself, how to activate is in the help, but I copied it here for you…

In order for the “A Better Finder Rename 10” item to appear in the Finder context menu and in other appropriate contexts, you need to manually activate the service in the “Services Preferences…”.

Proceed as follows:

  1. go to the Finder
  2. open the “Finder” menu and navigate to “Services”, then to “Services Preferences…”
  3. in the “Services Preferences…” application, tick the “A Better Finder Rename 10…” checkbox (in the “General” section) to activate the service
  4. optionally use the application to define a hot key (such as Command-Shift-R) for the service

The service should now appear in the Finder’s context menu.

If it does not, or if the item does not appear in the list, there’s a few things to check:

  • the “A Better Finder Rename 10” application needs to be in the “Applications” folder
  • you may need to launch A Better Finder Rename by double clicking it once
  • you may need to click on the “Force Services Menu Update” button in the “Services Menu Item” tab of the A Better Finder Rename 10 Preferences to force an update of Mac OS X’s services database.
  • you may need to log in and out (or restart) for the service to become available

These things might be necessary as Mac OS X checks all applications in the “Applications” and in the “Utilities” folders at start up to find out which applications define system services.

1 Like

I’m with Ken here, in that I have a HUGE number of old Appleworks files with no extension, and would like to add LibreOffice’s .odt extension. Trouble is, they are grouped with many other files of different creator types.

Does anyone know of any similar software with batch-renaming capabilities, that will search for files by hidden creator type and then add a file extension, either one associated with the file creator, or a different user specified .xtn?

Sadly, I have no Terminal abilities.

I’ve got a few old ClarisCad files that I’d like to add .xtns to and then try to crack open.

I don’t ask for much. :-))

If you use the command line and vim, look for vimv. There are a few versions, but they’re all basically little shell scripts that generate a list of filenames, drop you into vim editing a buffer containing those filenames, and then rename the files with the new names when you exit. This gives you the full power of vim (and any other command line program being vim can run them on the contents of a buffer) to modify the names, which easily eclipses what you can do with ABFR. Of course you have to have a little familiarity with bash and the more the better with vim, but if you do, it’s a great way to batch rename files.

Aha. I just hadn’t scrolled down far enough in Services Preferences to see “General”. ABFR (all the versions I’ve purchased!) was there. Ticked the box. All good. Thanks!

vim is my favorite program editor. I’ve been using vi for some forty some odd years. I’ve amazed other developers with how fast I can manipulate files and make massive changes.

An easy way to load up and manipulate file names in vi? You’ve got my attention.

Could you please explain a little what vim lets you do that ABFR doesn’t?

Thank you,

David

@ Ken Nellis: You can turn off the prompt in Finder Preferences>Advanced. It’s the second item on the menu, Show warning before changing an extension. Uncheck it and you won’t be bothered with that prompt again.

Wow! Talk about hidden treasures. Way hidden. I thought I knew my way around the Finder, but this is a revelation. I wonder how long this feature has been available.

That said, I’ve been using Name Mangler for years. One advantage it has is that it shows the results of your changes before you make them so you can see if your doing it right. If you pay attention it can save a lot of trouble undoing the wrong changes. Also, if you can handle the complexity, it enables you to do multiple operations in one pass.

Because Name Mangler does the job for me I haven’t tried A Better Finder Rename. If you try too many tools to do the same thing it can get confusing (as if renaming files isn’t complex enough, whatever tool you use).

But I may try this Finder secret, if I can remember it’s there, the next time I have to rename files just to see how well it works. So thank you Sharon for bringing this to light.

File Buddy by https://www.skytag.com has the ability to search by creator and then rename adding a file extension. I have it running all the time. I seldom use the rename ability for your your need I would. I find it to be an excellent file finding and manipulation utility.

@ B. Jefferson Le Blanc: Good to know. Thanx! —Ken

To David Weintraub: The loading up part is easy. For example::
$ ls *.txt > list_of_filenames
$ vi list_of_filenames
How to manipulate depends on what you want do to, but format each line into a “mv” (move) command, save, and then execute the file as a shell script.
—Ken Nellis

I quickly found three different versions of vimv, which all have their own unique features:


Basic Bash script, no options. Does git mv instead of mv when inside a git repository.

https://github.com/dosy4ev/vimv/blob/master/vimv.py
Python script with several options, including test mode, delete files if replacement name is empty, include hidden files, and manual filtering of some sort. (This also appears to be the most recently active of the three.)


Python script with only two options: include hidden files, and choose editor (default vi).

The ability to choose the editor is a winner for me. Great as vi is, I much prefer BBEdit for general use. :grin:

I’m very tempted to take all the good ideas from the various versions and write my own. :grinning: (when I have some spare time — HAHAHAHA)

vim is a program editor. It’s line oriented and not word oriented. It’s a frustrating editor for most people. For example, there are two distinct modes. One allows you to edit and enter text and the other is a “command mode” that allows you to move the cursor and manipulate text. There’s no menu system. However, once you learn the logic, it’s easy to make massive changes in a few keystrokes.

Like most Unix systems, vim uses regular expressions. You can usually imagine a simple instruction such as change all .txt suffixes to .markdown. You can do that with regular expressions, but so much more.

Here’s a simple (untested) Unix script:

find . -name “*img*.jpg” | while read file_name
do
   echo “mv \”$file_name\” \”$file_name\” >> command_file.sh
done

This creates a file of all the files found by the find command and puts them into a file called command_file.sh. Each line is a mv command which allows you to move or rename a file. As of now, each line moves the file to its own name.

mv img_0001.jpg img_0001.jpg
mv img_0002.jpg img_0002.jpg
...

Now, I can load this file into vim and with a few key strokes, change the names of the files that I’m renaming. For example, instead of starting with img, I want them to start with photo:

mv img_0001.jpg photo_0001.jpg
mv img_0002.jpg photo_0002.jpg
...

Now, I can run command_file.sh as a file of commands:

$ sh command_file

Because I am editing command_file.sh, I can manipulate it more easily than a single batch run. Maybe take out a line for that one file I don’t want to rename. Maybe change “img” to “picnic_at_the_park” for the first dozen, but “cave_adventure” for the rest. I can also verify each instance to make sure my renaming will do what I want.

A post was split to a new topic: Email error about how mail can’t be sent with the current server

I don’t know if you still have this issue, @simon1 , but this is super easily done in AppleScript with less than 10 lines; you can even set it up to easily batch change multiple creator codes to multiple corresponding extensions with very little effort.

It can be made to detect and display all creator codes within a batch of files for easy assignments.

It could be made into a Droplet app (drag a group of files to an icon for processing); run as a freestanding script; made into a Service available from the Menubar or Right-Click in Finder; hot-keyed, etc.

Somewhere I still have a droplet set that fixes extensions and creator codes for various file types, and is easily edited; or I could quickly write one for your needs and post here.

HTH

Frederico

@nellisks see my AppleScript suggestion above; it’s free and easy.

I own ABFR and have set up droplets for common renaming, generally for photography where it’s very useful indeed.

However, for most of my batch renaming I use Path Finder which has quite a bit of flexibility built in, can set up multipart naming etc. A very useful and configurable Finder replacement.

Huh. This is what happens when you learn all your Finder keyboard equivalents in 2001 and never look at the menus again. That’s a great story, Sharon.

I don’t think it’s been mentioned yet: probably the easiest way for people unused to Mac scripting is to use Automator, as there are drag-and-drop pieces you can use to make this script. And if you don’t feel comfortable creating Services and such, you can run it within the Automator window and save it like a regular document, then re-open it when you need it. (For seldom-used scripts and Automator actions, this is usually preferable anyway.)

If non-scripter want to delve into the command line or AppleScript for more powerful tools (command line has the advantage that there are more copy-and-paste examples generally available—with the disadvantage that some Linux one-liners don’t work on Mac), always make a backup of your target folders first, as these kinds of commands don’t have Undo and are a one-way trip.

Nice article, Sharon. You always write great stuff :slight_smile:

I dug this up because I wanted to do some creative bulk renaming. Your article helped me figure out that having “the default” in the Custom Format field was messing me up; I believe it must have been something left over from a previous rename, which is another discussion, not the least of which is about privacy.

Anyway!

I reject the label “Custom Format” for this field. It is not “custom” in the sense that it is not file-specific. And it’s not a “format” in that, unlike virtually any formatting construct (such as regex, Excel date formats, C printf-style formats, etc) it respects no tokens (that I have been able to find documentation on at least). In my case, I had given each screenshot a descriptive, meaningful filename that I did not want altered. I just wanted a chronological index prepended to them.

I think the label should be “Base Filename” because that’s all it is.

Oh, and I have one more gripe about the tool.

I had created about 20 screen shots during a web demo, and I wanted to prepend them with an index value in order to preserve their chronological order. The modification times of the files sorted them properly in the Finder, and I was hoping that if I selected them from oldest to newest that Rename would respect the select sequence in the rename, but it did not.

I think this is an old problem, where the order is generally right, but the first one is out of order. Of course, this messes up all the other filenames, making the automation useless.

What use is having an ordered index if the order doesn’t mean anything? All it allows is the batch of files to share a common basename, and the index acts to distinguish them, but the order is irrelevant.

The tool is better than nothing, and I know I can write a shell script to work around this. But they could do better. Have one engineer out of 1000 spend like 10 hours on this and bam; done.