Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nope7308

macrumors 65816
Original poster
Oct 6, 2008
1,040
537
Ontario, Canada
How do you configure Leopard so it automatically hides all file extensions?

I've gone to Finder/Preference/Advanced and unchecked the 'show all file extensions' option, but it does nothing. To remove the file extensions, I literally have to go into each individual file. There has to be some way around this, but I'm new to OS X and thus a complete noob.

As far as I can tell, extensions are showing for most (if not all) file types (e.g. avi, pdf, rtf, doc, docx, etc.). I tried searching for an answer, but with no luck. Any help is greatly appreciated!
 
In Terminal:

Show Hidden:
defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder

Hide Hidden:
defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder
 
Didn't work... any other suggestions?

Doh. I saw "hide" and immediately thought you were trying to show/hide hidden files, not extensions. Sorry--wrong command.

Finder doesn't hide all of my extensions either, but it did hide .rtf.

J
 
Doh. I saw "hide" and immediately thought you were trying to show/hide hidden files, not extensions. Sorry--wrong command.

Finder doesn't hide all of my extensions either, but it did hide .rtf.

J

OK, but why does Leopard hide .rtf extensions on your machine, but not mine? This is becoming a royal pain in the ass. I don't see the reason for hiding only some file extensions, but not all. What is so important about seeing .avi anyway?

There has to be some way around this...
 
It looks like Mac OS X just plain doesn't support this, unlike Windows. I did a Google search on this topic, and came up completely blank.
 
It looks like Mac OS X just plain doesn't support this, unlike Windows. I did a Google search on this topic, and came up completely blank.

The concept of a "file extension" is a Windows/DOS thing that was never really use with UNIX. Yes many user level programs would applend letters on the end of a filename but as rar as the Unix files system goes "." (dot) is just another character and files names like this are perfectly OK "this.is.a.valid.file.name" Finder does not care much that a filename has a "dot" in it. It treats the dot just like it would an under bar.
This has a long history in Unix that goes back long before there was a Company called "Microsoft".
 
The concept of a "file extension" is a Windows/DOS thing that was never really use with UNIX. Yes many user level programs would applend letters on the end of a filename but as rar as the Unix files system goes "." (dot) is just another character and files names like this are perfectly OK "this.is.a.valid.file.name" Finder does not care much that a filename has a "dot" in it. It treats the dot just like it would an under bar.
This has a long history in Unix that goes back long before there was a Company called "Microsoft".

Are you really suggesting that not being able to hide all file extensions at once is a benefit of OS X's unix inheritance? :rolleyes:
 
Sounds as if the reference file for the Finder is hosed. So quit all the running programs and the go the folder /Users/YourUserName/Library/Preferences/ and delete the file com.apple.finder.plist . Once you do that go to the Finder's menu item Preferences, Advance and make sure the check mark is un-checked. Hopefully doing this will help you.
 
Sounds as if the reference file for the Finder is hosed. So quit all the running programs and the go the folder /Users/YourUserName/Library/Preferences/ and delete the file com.apple.finder.plist . Once you do that go to the Finder's menu item Preferences, Advance and make sure the check mark is un-checked. Hopefully doing this will help you.

Still no dice...
 
Here it is. It's a global preference ( the "-g" domain" )

Show Hidden:
defaults write -g AppleShowAllExtensions -bool TRUE && killall Finder

Hide Hidden:
defaults write -g AppleShowAllExtensions -bool FALSE && killall Finder
 
That's not quite so...

Here it is. It's a global preference ( the "-g" domain" )

Show Hidden:
defaults write -g AppleShowAllExtensions -bool TRUE && killall Finder

Hide Hidden:
defaults write -g AppleShowAllExtensions -bool FALSE && killall Finder

That doesn't shows/hides ALL file extensions, that only shows/hides the hidden file extensions. It is exactly the same thing as de/selecting the option from the Finder preferences.

We are looking for an option that HIDES NON-HIDDEN file extensions; that is, files that don't have the "Hide extension" box checked. If the box is checked, the file is classified as a "file with hidden extension", which the code you provided controls.

What's interesting with all of this is that the "mac way" is to have all file extensions hidden, but we aren't given an option to have the UI the "mac way"
 
I found a way using AppleScript. You have to write this program in AppleScript (.scpt file) :
Code:
on run argv
	set posixPath to item 1 of argv
	set posixFile to POSIX file posixPath as alias
	tell application "Finder"
		try
			set extension hidden of posixFile to true
		on error e
			display dialog e buttons {"Ok"} default button 1
		end try
	end tell
end run
Then to run it on terminal :
Code:
$ osascript your_applescript_file.scpt complete_file_name_to_hide_extension
Of course, you can make a additional bash script to contain the bash commands to launch and to add the directory to the filename or make the more complex commands but you've got the basic ideas now.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.