How to Batch Change File Extensions in Mac OS

Nov 8, 2016 - 9 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.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

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

9 Comments

» Comments RSS Feed

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

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

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

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

  5. 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”?

  6. Sergiy Mike says:

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

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

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

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