One of OS X 10.10 Yosemite’s most useful new features — batch renaming in the Finder — has gone largely overlooked in the weeks since its release. In the past, you had to use a third-party utility, Automator, or some kind of shell script to rename a set of files quickly.
Batch renaming has a number of uses. For instance, if you’re trying to reduce paper in your office (as Joe Kissell suggests in “Take Control of Your Paperless Office”), being able to rename several PDF documents — such as scanned electric bills — at once is essential. Similarly, automatically generated log files or still images from a webcam might also lend themselves to batch renaming.
To get started, select the files you wish to rename in the Finder, using any of the standard methods. (Press Command-A if you want everything in the current folder; drag a selection box around them; select the first file in the series and then Shift-click the last file of the series; or press Command and individually select files.)
Once you’ve selected the files, Control-click one of the selected files, and choose Rename # Items, where # is the number of files selected.
In the resulting dialog, a pop-up menu lets you choose which action to take: replacing text, adding text, or performing more complex formatting. Pay particular attention to the preview in the lower left of the dialog, which shows you what the renamed files will look like. The options are:
Replace Text, which lets you find one string of text and replace it with another. In this screenshot I’m replacing the date with “Harris-Halloween”. Unfortunately, the Finder’s batch rename tool doesn’t understand wildcards or regular expressions, so there’s no easy way to get rid of the timestamp with Replace Text (but see below for an alternate approach).
Add Text, which adds a string of text before or after the file name. Here I’m adding “Harris-Halloween-” to the start of the filename.
Format, which either adds to or replaces the name with a pattern.
Format offers three different name formats that combine the files’ existing names with an index, counter, or date, each of which can appear before or after the name:
- Name and Index inserts a number, starting with the number of your choice
- Name and Counter does the same, but in a five-digit format, like 00055
- Name and Date adds the date in this format: YYYY-MM-DD at HH.MM.SS AM/PM
You can also replace the existing filenames by using the Custom Format field. The photos in my example screenshots are already named by date and time, and in the example below I’m renaming the files to start with “Harris-Halloween-” plus an index number.
This isn’t the sort of feature that most of us will need every day, but it’s important to remember that it exists for those times when you want to avoid the tedious task of renaming a slew of files according to a simple pattern.
Of course, independent Mac developers have long offered utilities that provide even more capabilities. Name Mangler from Many Tricks comes recommended by our own Jeff Carlson and Federico Viticci of MacStories, and others like A Better Finder Rename are also excellent choices. And if you want to rename files automatically, try Noodlesoft’s Hazel, but take care when setting it up, since with great power comes great ease in messing things up. I recommend testing on a subset before letting Hazel loose on a large number of files. For more on Hazel, see Joe Kissell’s “Take Control of Automating Your Mac.”