[HOWTO] - simply turn Finder's showing of hidden files on or off

Racer D

what?
I know there have been ways of doing this since like forever, but it always took an opening of one app (terminal or some prefpane) and relauncing finder. I've found a way to make it even easier ;)

1) navigate to /Applications/AppleScript and launch Script Editor

2) copy & paste this code into script editor's window
Code:
do shell script "if [ `cat ~/Library/Preferences/com.apple.finder.plist | grep -A 1 AppleShowAllFiles | grep string | cut -c10-11` == 'ON' ]; then
defaults write com.apple.finder AppleShowAllFiles OFF
else
defaults write com.apple.finder AppleShowAllFiles ON
fi"

tell application "Finder" to quit
delay 1
tell application "Finder" to launch

3) go to file / save and save to wherever you like with a name you like ;) but be sure to set file format to application and to uncheck all options

[optional]) change the file's icon

4) Now navigate to the folder where you saved your file and drag & drop the file into your Finder's toolbar (You have to hold the file above the toolbar for about a second and then drop it to make it work)

now, by clicking the icon in your toolbar, the finder will relaunch, toggling the state of hidden files (show/hide). clicking the icon again will toggle back.

it's a simple applescript that edits Finder's preferences file and relaunches Finder.:)

WARNING: hidden files are hidden for a reason. Use this script only if you know what you're doing. I hold no responsibility for f*cked up macs.
 
Racer D said:
now, by clicking the icon in your toolbar, the finder will relaunch, toggling the state of hidden files (show/hide). clicking the icon again will toggle back.

It doesen't work. I did every thing you said and I even did a fresh log out and nothing, the app oppens and nothing :(
 
hmm, there was some error whit the file when downloading obviously. I edited my original post, so now you have to create (copy & paste actually) your own script instead of downloading it.

Try it and tell me if it works now
 
fyi - i had this script as an app on 10.3. I then forgot i had it, upgraded to 10.4 and accidentally ran the script showing all those lovely hidden files. Unfortunately this script does not switch them back so that they are hidden. Thank you rawehage for the link to tweekfreak as that managed to switch them back off.
 
If anyone is still interested, here is teh updated script that works on tiger:

Code:
do shell script "if [ `defaults read com.apple.finder AppleShowAllFiles` == 'ON' ]; then
defaults write com.apple.finder AppleShowAllFiles OFF
else
defaults write com.apple.finder AppleShowAllFiles ON
fi"

tell application "Finder" to quit
delay 1
tell application "Finder" to launch
 
That's cool. Usually to get at those files I go to Terminal and give it the 'open' command for whatever directory I want and finder shows it.
 
It works nice, buit all the icons look grayish when Finder shows hidden files, is there any way to get them back with their original colors?
 
For those of us who don't much do scripts and terminal,
the easy way is to download TinkerTool (freeware) from
versiontracker.com.
 
Thanks for this great tiny script... I'm coming from Win and Linux, and greatly appreciating Mac Os X except for certain things like this of hidden files...

Keep going!

Cheers,
Alex
 
Back
Top