Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am running Mac OS X 10.8 (Mountain Lion) and had to edit an invisible file as part of an Android project. While I eventually found it, Spotlight was of no help, since it could not find an invisible file when searching for the exact name (.classpath) and with the 'File Visibility' option set to 'Visible or Invisible'.

Why didn't Spotlight work in this instance?

Can't find .classpath file even though it's right there

share|improve this question
1  
I used defaults write com.apple.Finder AppleShowAllFiles YES; killall -HUP Finder to show all of the files in the folder, though I wouldn't want to have to toggle that every time I want to search for a single invisible file. –  Eptin Jul 11 '13 at 0:26

1 Answer 1

Though, it won't update the results in spotlight I use the below script to toggle hidden files on and off every time it's run:

To make:

  • Open TextEdit
  • Make sure it is in Plain Text Mode (Format > Make Plain Text from the menu)
  • paste in the below text:
    #Load current state into I
    I=$(defaults read com.apple.Finder AppleShowAllFiles)
    if [ "$I" == "false" ]
      then
        # Flip
        I=true
        echo -e "\t>> Showing Hidden Files"
      else 
        # Flop
        I=false
        echo -e "\t<< Hiding Hidden Files"
    fi
    # Write I to com.apple.Finder.plist
    defaults write com.apple.Finder AppleShowAllFiles $I
    # Restart Finder
    killall Finder
    exit
  • Save the above file to your desktop as togglehidden.command (be sure not to append .txt to the end of the file)
  • Open /Applications/Utilities/Terminal
  • Enter the command chmod u+x ~/Desktop/togglehidden.command to make your new file executable.
  • Double Click togglehidden.command on your desktop to show or hide hidden files.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.