Shane Duffy

Mac OS X – Show hidden files script

Posted by: Shane Duffy on: September 23, 2007

Ok, so in my last post about showing the hidden files in finder I talked about the terminal commands but thats not always convenient for fast switching.

Below is some applescript that I wrote to do the job.


-- www.infosonicgroup.com
-- Shane Duffy

display dialog "Show hidden files in Finder" buttons {"Show", "Hide","Cancel"} default button 1
copy the result as list to {buttonpressed}

if the buttonpressed is "Show" then
my ToggleVis("ON")
else if the buttonpressed is "Hide" then
my ToggleVis("OFF")
end if

on ToggleVis(FileVis)
tell application "Finder" to quit
do shell script "defaults write com.apple.finder AppleShowAllFiles " & FileVis
delay 0.4
tell application "Finder" to activate
end ToggleVis

A great update has been developed by Tim over at http://dream.adeli.ca/ . He took the script I have written and made it super useful for everyone by creating a small application which can be embedded into the finder toolbar at the top of every finder window.
This makes the script very accessible and much more user friendly. Check it out here.

11 Responses to "Mac OS X – Show hidden files script"

[...] unknown wrote an interesting post today!.Here’s a quick excerptmy ToggleVis(”ON”) else if the buttonpressed is “Hide” then my ToggleVis(”OFF”) end if. on ToggleVis(FileVis) tell application “Finder” to quit do shell script “defaults write com.apple.finder AppleShowAllFiles ” & FileVis delay 0.4 … [...]

hey there. saw your post and was looking forward to using it. however, i get a syntax error when i try to run it. any chance you can provide a link to the compiied script or confirm that the syntax is correct?

many thanks!

Works fine for me.

Im using Tiger OS X 10.4.11

Just tried this and also got a syntax error too. Think I’ve found the problem:

Change line 15 from:

do shell script “defaults write com.apple.finder AppleShowAllFiles ” & FileVis

To:

do shell script “defaults write com.apple.finder AppleShowAllFiles ” & FileVis

And all should work. Thanks go to Shane Duffy for writhing this.

OK. So my last post may look confusing since it looks as though nothing has changed! If you compare the line15 I have written with line15 of Shanes script you will see I have removed “amp;” from after the “&” sign.
It seems somewhere along the line the code for the “&” sign is being displayed rather than just the “&” sign itself. Am I making sense?

Thanks a million chris for figuring that one out,

It must be something wordpress is doing when I copy and paste the code into it,

Will try get a download link setup for the script aswell!

No problem :) Thanks for writing the script, it’s comes in very handy!

Great work. I did this from the shell before, but so it is much more convinient ; )

[...] the Finder toolbar in OS X. I also often find the need to show hidden files in the Finder and run Shane Duffy’s AppleScript to do so. I though it would be great if I could have the ‘ToggleHiddenFiles’ script as [...]

Thanks for this great script. I’ve hacked it into a form whereby it can be added to the Finder’s toolbar so you can simply click a button to launch it. The file and a guide on how to change the icon can be found here – http://dream.adeli.ca/archives/posts/finder-button-to-showhide-hidden-files-in-os-x/

Best!

Just an update to the link in my previous comment due to some site changes I’ve been doing. This can now be found at – http://www.timothyfletcher.com/archives/posts/finder-button-to-showhide-hidden-files-in-os-x

Cheers!

Leave a Reply