Hiding and viewing dot files in Mac's Finder


I was talking about the problem that Finder is per default hiding dot files before. In most cases you get away with the default, but sometimes it really sucks that you cannot drill down into your 'hidden' directories. Since I work a lot with bash I added the following function to my ~./bashrc :

function switchFinderOptions()
   SHOW_DOT_FILES="defaults write com.apple.Finder AppleShowAllFiles YES"
   HIDE_DOTFILES="defaults write com.apple.Finder AppleShowAllFiles NO"
   echo "Choose finder mode:"
   echo  $SHOW_DOT_FILES '[1] ' ;
   echo  $HIDE_DOTFILES '[2] ' ;
   read ans
   case "$ans" in
     1) `$SHOW_DOT_FILES`;;
     2) `$HIDE_DOTFILES`;;
   killall Finder

After adding this function it becomes very easy to switch the Finder mode and quickly drill down a hidden directory structure.

Hope it helps.


Old comments

Seems like too big a hammer. I wish I could just press Command-Shift-D or something to see the dot files.
I like the idea of a command line function if that's the best we can do; though I would prefer to pass in flags. I'd show you my code, but I can't find a way to allow formatting to be preserved here. Oh well.
2010-12-31Hardy Ferentschik
If you want to share your code consider putting it onto forkcan and posting the link here.
You could also consider using TotalFinder as described in this post. You'll get a whole lot of additional Finder goodies including the ability to toggle he display of system files.