How to batch hide or display file extensions?

I've done this before, but can't find anything anywhere on how to do it again. In one folder, I just want to batch edit multiple files at once to show (or hide) their extensions. How does one do that?

MacBook Pro with Retina display, macOS Sierra (10.12), Late-2013

Posted on Dec 3, 2017 6:36 AM

Reply
3 replies

Dec 8, 2017 4:29 AM in response to Barney-15E

You can show or hide filename extensions for any file you choose, or a number of different files all at once. To do this for a single file, simply select the file in Finder and choose Get Info from the File menu, or by right-clicking on the file and choosing Get Info from the pop-up menu.


This brings up the information pane, which contains a checkbox that you can check or uncheck to toggle the visibility of the file's extension:

User uploaded file

To do this for multiple files all at once, it's best not to use the Get Info menu item, as—rather annoyingly—this will bring up multiple information panes all at once. Instead, press ⌘+⌥+I (Cmd+Alt+I) to bring up a single information pane that summarises the information for all of the selected files at once. This pane contains the same checkbox, which you can use to adjust the setting of all the files in one go.


It is possible to search for files in Finder based on whether or not their extensions are visible. To do this, open a Finder window and navigate to the folder which you wish to search (the search will also include any subfolders this folder contains). Start typing a search string (it doesn't matter what for now). When you do, the following bar will appear (I was searching in a folder called "Screenshots"):

User uploaded file

Now press the '+' button on the right, and the bar will expand into this:

User uploaded file

Press the drop-down menu on the left, where it says Name. This reveals a list of different search criteria. The very last item is Other.... Choose this one to bring up a dialog box that presents you with all the possible search criteria against which one can search for files from a Finder window. One of these criteria will be the one you're after:

User uploaded file

Check the checkbox on the right to make it available in the drop-down menu from before and press OK. Now choose this option and the desired value, i.e.whether you want to search for files with extensions that are hidden ("Yes"), visible ("No"), or either ("Any"), and clear the text from search field or type in some additional search parameter to narrow your results. This should populate the window with a list of files that match these criteria.


Finally, for completeness, it is also possible to do this through AppleScript, though I suspect you no longer need this option. But, in case you do, this line of AppleScript will fetch all the files in any given folder that have hidden extensions:


tellapplication"Finder"toget (everyfilein (POSIX file"/Users/CK/Desktop/"asalias) whoseextension hiddenistrue) asalias list

And this line will make the extensions of every file on the desktop visible:

tellapplication"Finder"tosetextension hiddenofeveryfilein (POSIX file"/Users/CK/Desktop/"asalias) tofalse

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to batch hide or display file extensions?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.