MacOS – How to hide all file extensions in subdirectories of a given folder

file extensionsmacos

I know that I can open the file information dialogue (Get Info) for several files at once using ⌘⌥I and hide/unhide file extensions. How do I accomplish this for all files in a directory tree (including files in subfolders)?

Best Answer

You can easily do this in Terminal with the SetFile command:

To hide file extensions in a directory and all sub-directories:

cd <path to directory>

find . -name "*.*" -exec SetFile -a -E '{}' \; | echo "hiding extensions"

(can change the second * to a particular extension type if you choose)

To show file extensions in a directory and all sub-directories:

cd <path to directory>

find . -name "*.*" -exec SetFile -a -e '{}' \; | echo "showing extensions"