Hide ONLY .app file extensions but show the rest
The "Show all filename extensions" option overrides the "Hide extension" option in Get Info. This means that there are a few possible solutions one could try to find in order to hide ".app" extensions while showing the rest:
- Find a way to exclude certain extensions from "Show all filename extensions".
- Find a way to hide extensions, other than the "Hide extension" option, that it is not affected by the "Show all filename extensions" option.
- Find a way to override the "Hide extension" option, other than the "Show all filename extensions" option, that can be configured to include or exclude items based on their extensions, or perhaps even by their location (e.g. exclude the Applications folder).
To the best of my knowledge, none of these are possible, but I would be happy to be proven wrong about that.
Possible Workaround
The easiest workaround I can think of is to leave "Show all filename extensions" unchecked and to manually set other files to explicitly show their extensions, which can be done very easily with Automator and the SetFile
command.
You can set this up as either a service or an application. In both cases, it can be used on both files and folders, and will also process the contents of subfolders.
To set this up in Automator, add a "Run Shell Script" action, set "Pass input" to "as arguments" and set the script to this:
(Note: You have to install Xcode to get the SetFile
command.)
for f in "$@"
do
find "$f" -name "*.*" -exec SetFile -a e {} \;
done
If you set this up as a service, be sure to change "Service receives selected" to "files or folders".
You could also look into using this as a folder action. As files are added to a folder, the script will automatically set their extensions to be shown. For example, it could be useful to attach such a folder action to Downloads, Documents and the Desktop, or any other folder which frequently receives files with "Hide extension" checked.
Hopefully, setting this up as a service would make it so trivial to use that you wouldn't even need to worry about batch-processing an entire volume (which could take awhile). Rather, you could simply use it as needed whenever you come across files or folders of files with hidden extensions.
This AppleScript will hide the extension of apps (everything with a ".app" extension) directly in the Applications folder (however, it doesn't work on apps in subfolders).
I made this a Community Wiki answer so if anyone can edit this script to improve it, please do so!
tell application "Finder" to set files_ to every item in (path to applications folder) whose name ends with "app"
repeat with file_ in files_
tell application "Finder"
try
set extension hidden of file_ to true
on error e
display dialog e buttons {"OK"} default button 1
end try
end tell
end repeat