Jump to content
Sign in to follow this  
Graham

Toggle hidden files in the finder

Recommended Posts

Graham    1

I didn't write this, but I can't for the life of me remember where I got it. I run this as an applescript using quicksilver, but it will work equally as well as an automator app (copy and paste the script into a Run AppleScript automator thingie). This works on both Leopard and Tiger (hasn't been tested in older versions).

 

Basically, it quits the Finder (so make sure it's not doing anything such as copying a file - any shares that you have mounted will be disconnected as well), checks the system version (it needs to do slightly different things if it's running on Tiger or Leopard), reads the current value of the plist and then sets it to the opposite value. Run again to toggle it. This allows you to see all kinds of files that are hidden by the operating system - useful for web developers who need to edit .htaccess files for example.

set Leopard to (system attribute "sysv") mod 4096 div 16 = 5

quit application "Finder"
try
if Leopard then
	set b to (not ((do shell script "/usr/bin/defaults read com.apple.finder AppleShowAllFiles") as integer as boolean)) as integer
else
	set b to (((do shell script "/usr/bin/defaults read com.apple.finder AppleShowAllFiles") is "ON") as integer) + 1
end if
on error
set b to 1
end try
if Leopard then
do shell script "/usr/bin/defaults write com.apple.finder AppleShowAllFiles -bool " & item (b + 1) of {"No", "Yes"}
else
do shell script "/usr/bin/defaults write com.apple.finder AppleShowAllFiles O" & item b of {"N", "FF"}
end if
delay 1
launch application "Finder"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing

    No registered users viewing this page.

  • Who's Online (See full list)

    There are no registered users currently online

×