How to Batch Change File Extensions in Mac OS

Nov 8, 2016 - 22 Comments

How to batch change file extensions on Mac

Have you ever wanted to change a group of files file extensions in Mac OS? For example, lets say you wanted to change a bunch files with a .htm extension to .html, or a group of files from extension tie .JPEG to .PNG. We’ll show you how to easily batch change a group of file extensions on the Mac, without changing the actual file names.


Remember this is only changing the file extension, this is not actually changing the file type or performing any file conversion. We have plenty of articles about various file format and type conversions if you’re interested in that, however. This is also not changing the file names, it is only changing the extension that comes as a file suffix.

We’re going to use the same rename feature that allows batch renaming of files on the Mac but with a few slight modifications to the usage and related system preferences so that it focuses on changing the file extension rather than the file name. It’s a subtle difference but important if all you want to do is maintain file names but change the file extensions.

Batch Changing File Extensions on Mac

  1. From the Finder of the Mac, pull down the “Finder” menu and go to “Preferences” and then go to “Advanced”
  2. Check the box for “Show all filename extensions” and then uncheck the box for “Show warning before changing an extension”, then close out of Finder preferences
  3. Turn off file extension change warning and enable show file extensions

  4. Now locate the files or folder of files that you want to change the file extensions for in the Finder and select them all, then right-click (or Control Click) and choose “Rename XX Items…”
  5. Select all files and choose rename to change their extensions

  6. At the “Rename Finder Items” screen choose ‘Replace Text’ and then within the “Find:” section place the initial file extension, and under the “Replace with:” input place the file extension you wish to batch rename all of the selected files to, then click on “Rename”
  7. Replace one file extension with another file extension

Assuming you followed the above steps correctly, you will successfully have changed only the file extensions of the selected files, and not changed any of the names.

File extensions have been changed for all selected files

In the example above we changed a group of image files from having a “.jpeg” file extension to having a “.PNG” file extension, but you can use this with any file extension, whether it’s changing a group of files from having .docx to .doc, .txt to .php, or anything else. The extension you are choosing does not matter, though you’ll obviously want to pick one that is compatible and accurately represents the file type otherwise it may make it unreadable to some applications.

A few important points here: you must have show file extensions enabled on Mac otherwise the file extensions to change will not be visible or found by the replace tool, and secondly you must turn off the file extension change warning otherwise you will be repeatedly confronted with a dialog box to confirm the file extension has changed for each individual file extension change. Beyond that, it’s just a matter of using the batch Rename feature built-in “Find and Replace” functionality as shown.

Once you’re finished changing the group of files file extensions you are free to adjust your Finder Preferences back to whatever setting you’d like. Generally speaking it’s a good idea to leave the extension change warning enabled, however.

You could also accomplish this batch extension changing process through the command line using a variation of this trick, we’ll cover specifics for that in another article.

.

Related articles:

Posted by: Paul Horowitz in Mac OS, Tips & Tricks

22 Comments

» Comments RSS Feed

  1. Arc says:

    This is one of the best tip i’ve seen in years. Thank you so much

  2. Matt Kemp says:

    Thanks so much. I have recently moved to Apple and had no idea how to do this. You have solved a major issue for me after my file recovery software changed CR3 files to MOV files. Where do I send the case of beer? :)

  3. Mads says:

    I am struggling with this method, as I have thousands of exec files with no file extensions. The file names are simply ascending numbers. I am trying to convert the files to .txt format so I can read them, as when I manually add .txt to one file, it becomes a TextEdit file. But I can’t do this in bulk. When I get to the “replace” step, there is nothing to mark for replacement. What would you suggest?

  4. diana says:

    THANK YOUUUU

  5. I would choose the command line approach if possible. No offense but I’m trying to rename 10s of 1,000s of files (from an iPhone backup) and the warning dialogue that pops up for this is defaulted to say don’t change so I have to click for each with my mouse.
    It wouldn’t be so bad if it defaulted to say ok cause then I can just stick a screwdriver into my enter key and let it go for 1/2 hr. But even with the number pad used for left click the os won’t repeat the inputs like it does for a keyboard tap so I’ve got to click the mouse each time.

    So again I strongly recommend the Terminal.
    Meanwhile I’m trying to figure out how to get Automator to do it for me if anyone has any tips on that.

    Thanks

  6. Chiranjit says:

    I badly needed this to rename my iPhone’s video extensions to play in Adobe Premiere pro.
    Thanks a lot.

  7. John says:

    This was just what I needed, thanks! I had to email a bunch of files to an aerospace firm, and they require a specific extension during transmittal, which they will change back later. So this was an excellent way to change 216 files in a second!

  8. Jennifer says:

    Thank you!!!! I used PhoneTransfer for two years and my voice memos never had the .m4a extension. Before, I would manually add it!!

    Thank you repeatedly!

  9. Ila says:

    I had 48 photos to convert from .NEF to .jpg, thanks for saving hours of my life

  10. Margaret says:

    It’s nice to know this feature is built into Sierra. However, there’s something I need to do that I can’t figure out how, though, with Finder’s Find/Replace or Rename functions, Automator, Easyfind, or BetterFinderRename. Certain image files I use in a genealogy program somehow lost the dot before the extension, for instance, image_example.jpg became image_examplejpg.

    There is a “contains” option, but not a “does not contain” option. There is an “ends with” option but not a “does not end with”. If I search on “jpg” I will end up with all the files, whether they have the dot or not. If I search on “.jpg” I will get all the files I’m not looking for. There are “is” and “is not”, but I can’t apply this to multiple files with different names.

    I could search for “jpg” and rename the files “.jpg”, but then I would end up with a lot of files named “..jpg”. I could then search for “..jpg” and rename those files “.jpg”. I suppose that would work, but it seems like a really clunky workaround. I also have a concern, perhaps a superstition given my level of knowledge, that all that changing around of extensions may corrupt the files somehow.

    Any suggestions?

  11. Sergiy Mike says:

    Long path tool lets you manage and even rename files that have more than 255 characters.

  12. Polgs says:

    Did I miss something in the instructions? It looks like it’s simply a find and replace on the filename so, what if I have a file called
    “timelog2016-10.log”
    and want to change the extension to “txt”
    Wouldn’t I end up with,
    “timetxt2016-10.txt”?

    • RC says:

      Nope.
      You are doing a find and replace, so, change slightly what you are finding to .log

      and the replace to .txt

      got it?

  13. Sebby says:

    Yep, this is one of the most surprising and delightful functions in the Finder. Sure I could do it with a suitable command-line kludge (notice that using “for” exposes you to shell-quoting hell with filenames containing special characters) but having a pure solution from Finder is immensely handy.

    Why did I need it last? Once I’d run all my Audible AAX files through ffmpeg to decrypt them, they became m4b files (AAX is nought but encrypted m4b). So rename them to tack on the m4b extension, remove the encrypted files from iTunes, and drop the m4b files into place. Bingo–one decrypted Audible library, immune to library portability and the scourge of DRM.

  14. User says:

    I use an app that does this, and more, but it’s still a handy tip for those who know what they’re doing, and need such a function without resorting to additional software.

    Despite the skepticism, there are valid instances aside from tidying up some extensions (.jpeg to .jpg), such as opening .log files in a text editor instead of Console, instead of making it a blanket default, or having to invoke Open With every time or for a select batch of files.

  15. junebeetle says:

    Useful tip, but a lot of users are going to get confused by this… my 2¢ for file extensions:

    1. Turn on file extensions (as shown above). That way you can tell what things are.

    2. Never change a file extension unless you 100% know what you’re doing. All a file extension does is tell the OS what type of file it is. Changing it simply changes the name, and calling your Photoshop document a JPEG doesn’t make it one.

  16. Chris Quirk says:

    What on earth would be the point of changing a bunch of jpg files to png. No-one would be able to open them!

    Maybe I’m missing a long-lost reason for doing this.

    Once you muck about changing file extensions, all hell lets loose.

    The one use (and only as far as I can see) is, admittedly, changing htm to the far-nicer html.

    But let’s break our Macs anyway…

    • Gurbleberb says:

      The article discusses how to change a group of file extensions from one file extension to another.

      Here is command line approach, where txt becomes py

      for f in *.txt; do mv "$f" "${f%.txt}.py"; done

      It’s an example. You yourself offered an example, after wondering what a purpose would be for. Just writing our your stream of consciousness, I see.

    • Gajet says:

      Not JPG’s but I’ve just had to do this with my parents in-law’s video camera which records in a .MOD format which in reality are just .AVI’s but media players won’t recognise them without changing the fie extension.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site