Skip to content
Thoughtful, detailed coverage of everything Apple for 34 years
and the TidBITS Content Network for Apple professionals
A pile of name badges.

Photo by Gratisography


macOS Hidden Treasures: Batch-Rename Items in the Finder

When I was preparing inline graphics—the little images embedded in a line of text—for my Take Control of Numbers book, I was almost finished when I remembered that the filenames needed to adhere to a naming convention: they must end with _inline. Nearly 50 files needed renaming. A brief mental facepalm moment was followed by the relieved realization that the Finder could do it for me with its batch-rename capability.

You didn’t know the Finder has a batch-rename capability? That’s because the option is disguised as a seemingly useless Rename command in the File menu. After all, you can rename a file by clicking and typing. So, the Rename command has no reason to exist—until you’ve selected multiple items. Then, it changes to Rename [X] Items (identifying the number of selected items). But how would you know that since you aren’t likely to peruse menus after you’ve selected a bunch of files or folders?

And that’s how you start: select multiple items in any window view (including, if you need to, a mix of files and folders) and choose File > Rename [X] Items. (For the rest of this article, I’ll refer to the command as simply Rename Items.)

The Batch-Rename Triad

When you choose Rename Items for a selection, a dialog appears. (If you’re working in a window, it slides out from the title bar; if you’ve selected items on the desktop, you get a free-floating version.)

Using Rename Items in the Finder.

Its pop-up menu offers three options:

  • Replace Text: Change any part of the existing filename to some other text. This option also lets you delete characters from filenames by replacing the existing text with nothing.
  • Add Text: Add text before or after the filename.
  • Format: Append an index or counter number (the latter uses leading zeros for a fixed number of digits) or the current date and time to the filename. You can place the number before or after the filename, replace the filename with different text, or obliterate the original name completely.

We’ll take a look at each of these options in action.

Replace or Delete Filename Text

How many files do you have whose names start with IMG_? Every time you dump images from your camera to your Mac, they’re named with that prefix, followed by a 4-digit number. Replace those leading characters with a descriptor so that you’ll know what’s what:

  1. In the Finder window with the photo files, choose Edit > Select All, and then File > Rename Items.
  2. Choose Replace Text from the dialog’s pop-up menu.
  3. In the Find field, enter IMG_.
  4. For Replace With, enter a description: Pool Party, Graduation, Disney World, or whatever. Be sure to include a trailing space or some other separator after the text. (Alternatively, set only IMG to be replaced, leaving the underscore.)
    Replacing filename text in the Finder.
  5. If the example in the lower left of the dialog looks right, click Rename.

Have you ever wound up with a bunch of montly reports scattered among your monthly ones, or some similarly repeated typo? To replace montly with monthly:

  1. Select the target files and choose File > Rename Items.
  2. Choose Replace Text from the pop-up menu.
  3. In the Find field, type montly; in Replace With, type monthly. Or, use shorter text replacement, such as substituting tly for thly as long as it wouldn’t interfere with other text in the filenames.
    Fixing a montly typo with the Finder.

You might be tempted to use the even briefer change of ly to hly; with that approach, however, if some of the files were correctly named to begin with, they would wind up with an extra h—monthhly. I recommend using full words to avoid problems that you might not notice while they’re still easily undo-able—although I confess this is a case of “Do as I say, not as I do.” If it’s too late to undo the mistake, it’s usually a cinch to do a second, more careful, batch rename to correct the issue. (Undo details are in the “Quick Tips” list at the end of this article.)

You can also use the Replace Text option to delete text from a filename: simply enter the delete target in Find, and leave Replace With blank. So, if you’ve decided that Monthly Report for January and its subsequent files are a tad redundant, set Find to monthly—making sure to include the trailing space—and leave Replace With empty.

Using Replace Text to remove text from a filename.

There’s another example of deleting filename text ahead, under “Multiple-Pass Renaming.”

Add Text to Filenames

The Add text option in the Rename dialog lets you—you guessed it!—add text to the beginning or end of the filename: choose Add Text from the menu, type the additional text, and specify whether it goes before or after the name.

This is what I used to append _inline to my graphics, the issue I mentioned at the beginning of this article. You might find that you need to add a project name to a group of files, or that you forgot to append your initials to revisions of shared documents. Here’s how to make a simple adjustment like this:

  1. Select the target files.
  2. Choose File > Rename Items.
  3. In the dialog, choose Add Text from the pop-up menu, type the text, and choose Before Name or After Name from the second pop-up.
    Adding _inline to filenames.
  4. Click Rename.

As you can see in the screenshot above, an “after name” addition ignores the file extension (.png) because it’s not considered part of the file’s name.

I frequently use this method to add leading zeroes to the beginning of single-digit numbers so I can more easily scan the then-even text in a list of numbered filenames. With just the single-digit files selected, I set the Rename option to Add Text, type a zero in the text field, and choose Before Name from the second menu.

Adding leading zeroes to filenames.

Format Filenames with Numbers or Dates

The Format menu choice in the Rename dialog is not a shining example of nomenclature, for either its title or its contents. Your formatting options are:

  • Name and Index: Adds consecutive numbers, starting at 1 or a number you specify.
  • Name and Counter: Adds consecutive numbers, also starting at 1 or a specified number, but creates five-digit numbers by padding with leading zeroes where necessary: 00001 and 00237, for example.
  • Name and Date: Adds the current date, as well as the time, down to the nearest second, in the format 2018-05-23 at 9.27.55 AM.

With each of these options, you can keep or replace the original filename, using the awkwardly named Custom Format field. Oddly, it usually starts with File as the default suggestion (without even the courtesy of a leading space, as you can see in the dialog’s Example line in this picture).

The Custom Format field.

To replace the current filenames with a common name—so, for instance, only an index or counter number differentiates them (Field Test 1, Field Test 2)—enter that name in the Custom Format field. If you want the original name left intact, the Custom Format field must be blank, as shown in this picture.

Changing filenames with the Custom Format field.

It’s not immediately apparent how either of the numbering options is applied to selected files. Here’s the trick: when you’re working in a List view that has the names in the first column, as is nearly always the case, the numbers are applied, in order, to those names. No surprise there, but the controlling factor is actually the window’s sort order—Dated Created, say, or Size—which, of course, affects the order of the names. So make sure to get your files in the right order before renaming them.

Multiple-Pass Renaming

Sometimes renaming requires more than one pass: altering the name, then adding a date, and finally deleting the timestamp that accompanies the date, for instance. But edits are simple to set up and take only seconds to run, so multiple passes are not time-consuming procedures.

Reword Filenames

If your files are named Monthly Report for [Month], and you’d prefer them to be [Month] Report, run them through the rename mill twice, first stripping Monthly Report for, and then adding Report to the end of the filenames:

  1. Select the target files and choose File > Rename Items.
  2. Choose Replace Text from the pop-up menu and type Monthly Report for (including a trailing space) in the Find field. Leave Replace With blank, and click Rename. The files are now named with only the month.
  3. With the files still selected, choose File > Rename Items again. Choose Add Text from the pop-up menu and type Report in the text field; choose After Name from the second pop-up, and click Rename.
    Rewording a filename.

Strip the Time from Date & Time

I firmly believe that the application of a date stamp should be separate from a timestamp, but Apple failed to consult me on the matter. Luckily, it’s easy to strip out the time:

  1. Get the exact wording of the timestamp portion of the renamed files by copying it from one of the filenames: select one of the files, activate its name by clicking it or pressing Return, and drag across the timestamp portion, including the “at” but leaving the leading or trailing space.Copying the timestamp portion of a filename.
  2. Select all the target files and choose File > Rename Items.
  3. Choose Replace Text from the pop-up menu.
  4. Paste the copied timestamp into the Find field, and leave the Replace With field blank.
  5. Click Rename.
    Stripping the timestamp from a filename.

Quick Tips

Here are a few more things you should know:

  • Quick access to the Rename command: Tired of heading way up to the File menu for the Rename Items command? I have three solutions for you. Control-click any one of the selected files for a contextual menu that includes the Rename command, use the Action menu (the gear Gear icon inline image. icon) in the window’s toolbar, or… the third gets its own tip, next.
  • Keyboard shortcut for the Rename command: If you use the Rename command frequently and are the type of person who prefers keyboard commands, then you’ll be disappointed when you realize that you can’t set up a keyboard shortcut for a command whose wording constantly changes (Rename 4 Items, Rename 12 Items…). Except that you can—in a roundabout sort of way: set up shortcuts for many different versions of the command and assign all of them the same shortcut. (Who knew? I didn’t, until I decided to try it for this because I prefer keyboard shortcuts for almost everything.) The method is no different from setting up other keyboard shortcuts:
    1. Go to System Preferences > Keyboard > Shortcuts and click App Shortcuts in the app list.
    2. Click the + button beneath the shortcut list and choose Finder from the pop-up menu in the dialog box. (If Finder is not in the shortcut list already, this procedure adds it; if it’s already listed, you still need to select it as the target.)
    3. In the Menu Title field, type Rename 6 Items…. (You don’t have to use the ellipsis character—typed with Option-semicolon—you can simply type three periods.)
      Creating a keyboard shortcut to rename files.
    4. Go to the Keyboard Shortcut field and press the key combination you want to use.
    5. Repeat this process for other numbers of files in the command name, using the same key combination.

I’ve found that System Preferences occasionally objects to the use of the same shortcut for multiple commands, but only mildly: sometimes not all the commands are listed correctly in its window, showing only an ellipsis (…) in place of the command name. But the shortcut keys remain displayed, the command names return on a subsequent opening of System Preferences, and all the shortcuts work in the meantime, so it’s only a minor glitch.

  • Case insensitivity: In the Rename dialog box, the text you enter that is going to be replaced or erased is case insensitive—that is, upper- and lowercase letters are considered the same. But any replacement text will be used exactly as you type it.
  • Undo a rename mistake: Whether you inadvertently introduced a typo while renaming files, chose the wrong option (counters instead of serial numbers, say), or realized the renaming just isn’t what you want, you can use the Edit > Undo command to reverse the changes. If you change your mind about that, there’s Edit > Redo to the rescue. You can even go through several undo levels: if you added a serial number to the beginning of the file, and then a corrected project name to the end, you can undo each in turn to get back to the original filenames. Even if you’ve closed the window and opened others, you can go back to the folder of renamed files and undo the changes. There are some restrictions, of course, such as not having done anything undoable someplace else in the Finder.

Subscribe today so you don’t miss any TidBITS articles!

Every week you’ll get tech tips, in-depth reviews, and insightful news analysis for discerning Apple users. For over 33 years, we’ve published professional, member-supported tech journalism that makes you smarter.

Registration confirmation will be emailed to you.

This site is protected by reCAPTCHA. The Google Privacy Policy and Terms of Service apply.

Comments About macOS Hidden Treasures: Batch-Rename Items in the Finder

Notable Replies

  1. Time stamps tend to differ. Your example with all files having an identical time stamp is not very realistic.

    Is there a way to match any number or character in the find part to get rid of differing time stamps?

  2. You’re probably thinking of the “date/time stamp” that identifies the creation or modification date of a file/folder, which, of course, usually differ, if only by seconds. But the example I used was regarding the date/time stamp applied from the Rename dialog, which puts the same date/time in the name of all the selected files; it uses the current date/time, which is unrelated to the creation/modified date stored internally for the items. I was showing how you can delete the time portion (which is unlikely to be of use) of that stamp.
    And no, there’s no way to do any kind of wild-card search/replace with the quite basic Rename command. (Would that there were!)

  3. I was interested to read the article: it came as a complete surprise to me that this feature existed in the Finder.

    A more flexible way of renaming files, which allows use of regular expressions, is NameMangler, from ManyTricks ( It’s not free but it works very nicely. I have no connection with the company.


  4. I agree, A Better Finder Rename is an awesome piece of software. I especially like it’s ability to create droplets for frequently used renaming schemes.

  5. I used to use “A Better Finder Rename” frequently.

    But since the batch-rename feature got added to the Finder, I haven’t used ABFR once. ABFR may be more powerful, but built-in functionality beats using a separate app any day.

  6. ABFR is available via Right Click in the services menu. Highlight the files you want to rename, Right Click, select and you’re there. I’ve tried the built in finder rename and for all but simple things it pales in comparison. But then my needs are typically fairly complex and I love what I can do in ABFR (such as renaming audio files based on their Meta Data).

  7. One way to do batch file renaming is to use the Unix command line utilities. With the various Unix command line utilities, you can find files based upon complex patterns in the name, use the date and time stamp, and move into multiple folders.

    If you’re somewhat technically minded, it might be worth learning some basic Unix tools and Bash shell scripting. I find myself using it for some niggling task about two or three times per month.

  8. Richard –
    May I assume that you added ABFR to the Services menu yourself? It’s not there on mine.
    (MacOS Sierra 10.12.6)
    Tried adding AFBR using Automator, but couldn’t quite figure out the process.
    Hints? Comments?

  9. Ken

    Some of us old-timers, i.e. pre-OS X, still have files without extensions. I just used this feature to rename a batch of such files to add an extension, and on every file I got a Finder prompt, “Are you sure you want to add the extension to the end of the name?” Options are only Don’t Add and Add. No Add for All. Not the best user experience. Besides this inconvenience, glad to know about this feature. More convenient than dropping into Terminal. Thanx for sharing! —Ken Nellis

  10. The killer feature of ABFR is that you can actually provide a list of filenames and replacement names for them. I haven’t used this feature often but a few times it saved my bacon as I had to rename hundreds or even thousands of files.

    Ufnortunately there don’t seem to be any recent updates.

  11. ABFR has been updated 6 times in 2018, the latest being 30th May 2018.

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

  13. 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. :-))

  14. blm

    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.

  15. 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!

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

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

    Thank you,


  18. @ 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.

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

  20. File Buddy by 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.

  21. Ken

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

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

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

  24. 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
       echo “mv \”$file_name\” \”$file_name\” >>

    This creates a file of all the files found by the find command and puts them into a file called 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 as a file of commands:

    $ sh command_file

    Because I am editing, 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.

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



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

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

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

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


    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.

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

Join the discussion in the TidBITS Discourse forum


Avatar for jeff-porten Avatar for tommy Avatar for bob2 Avatar for dave1 Avatar for jbr Avatar for ecdm7k2jxv Avatar for peter6 Avatar for frederico Avatar for jeff5 Avatar for allen.gainsford Avatar for croettger Avatar for nellisks Avatar for davbro Avatar for blm Avatar for nigel.stanger Avatar for gilbrh Avatar for szardetto Avatar for david19 Avatar for simon1