OSX: Toggle hidden files in Finder

Here's a little shell script I knocked up for toggling hidden files in finder.

Running from the Finder toolbar

To have this to hand from within finder you can create an application in Automater. Just select run shell script and paste the contents of this script.

Save it as an app. If you want to have it on the toolbar find the saved app and Cmd+drag it to the toolbar in Finder.

Note: if it doesn't work for you try substituting TRUE/FALSE for YES/NO

Running from a terminal

If you prefer to eschew the applescript niceties then you can also simply run this from a terminal when you need it.

Save it in a directory in your $PATH e.g. ~/bin/toggle-hidden

Then chmod +x ~/bin/toggle-hidden so it's executable.