Right click on the file, hold down Alt/Option, and an item to copy file path will appear as Copy "<FILENAME>" as Pathname
.
This is the easiest option for day to day usage, without involving Automator.
This seems to be a relatively new feature that was added in OS X El Capitan. (It also works on macOS Sierra).
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.
Best Answer
If you have Xcode installed you can try the SetFile command. The command below should unhide the hidden file.