Shane Duffy

Mac OS X – Show hidden files script

Posted 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.

Advertisements

12 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!

4-25-10

LINKS to Tim’s site NO longer work, guess he took down that section. I still use this in Snow Leopard, but it does fail now and then, and forces a finder restart. I learned about the BUG from some other site, pasted below as well.

User Reports Bug on OS 10.5.8 & 10.6.3 (Snow Leopard)

The operations do not always complete, and will be asked to make a decision on the next action which will end in the Finder quitting.

Also, if you are able to exit properly, the last viewed hidden folder will remain visible until you navigate away, and then it will be invisible if you return.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Subscribe to this blog now!

Top Clicks

  • None
September 2007
M T W T F S S
« Aug   Oct »
 12
3456789
10111213141516
17181920212223
24252627282930
%d bloggers like this: