Quick Tip: Hide Files and Folders From Spotlight Search
Many of us have files that we don’t want falling into the wrong hands but to which we still need easy access. I’m less worried about encrypting my files and more concerned with camouflaging a few folders that contain personal data.
The most obvious way to keep my files flying under the radar is to remove them from Spolight’s search results. There are several simple ways to do this, and I’ll run through three in this Quick Tip.
1. Add .noindex to the Filename
Hide Files in a .noindex Folder
One of the fastest ways to hide a file or folder, from Spotlight, on the fly is to add the .noindex extension to the end of the filename or folder. The simplest way to get those files hidden is to create a folder, preferably named something innocuous, and add the extension to the end of the name. I’ll end up with a folder named “Nothing to See Here.noindex” or something similar.
From there, I just drag all of the files I want to hide from Spotlight into the folder. I can check that they’re now hidden by searching for them in Spotlight. While I’ll no longer be able to access my hidden files from Spotlight, I can still click to them in Finder.
Hide the File Itself With .noindex
If I don’t want to create a special folder just to hide a couple of files, I can add the .noindex extension to the file itself. This is a little more involved, though, as OS X tends to work as hard as it can to preserve the file’s original extension.
Select the file to be hidden. Right-click and select Get Info, or click Command+I. Find the Name & Extension field, and replace the current extension with .noindex. When prompted to confirm that I want to change the extension, I agree. Now my file is properly hidden from Spotlight search.
Tip: Clicking on the filename in Finder to change the extension may only tack .noindex onto the filename before the original extension. The extension may appear to have changed, but the Get Info window will confirm that the extension was preserved.
Finder won’t know what to do with my file anymore, though. Look to the drop-down labeled Open With, and select an application to handle the file. Be careful of setting a single application to handle all .noindex files, as many different file types may be hidden from Spotlight, and OS X sometimes creates .noindex files itself.
2. Hide the File in the Library Folder
Though there are ways to get around it, Spotlight doesn’t search the Library folder by default, and while not completely inaccessible, Finder doesn’t make getting to the Library folder particularly easy, either. That means the Library folder is a great place to stash files, hiding them from both Spotlight and the prying eyes of a guest user.
In Finder, hold Option while selecting Go from the menu bar. This reveals the Library folder. Once in the Library, create a folder that will look at home with everything else in there, such as “App Files.” Any files I want to conceal can just be shifted to that folder, and they’ll be hidden from Spotlight and most casual users.
3. Use Spotlight’s Preferences
Spotlight will prevent searches of specific folders in its preferences. Select Spotlight Preferences from Spotlight’s search results or open Spotlight Preferences in System Preferences. Select the Privacy tab.
Click the plus sign in the lower left to add folders to the list, or drag folders directly into the pane. Unfortunately, the Spotlight blacklist won’t accept standalone files, but any folders added here will be excluded from Spotlight searches.
Each method outlined has its advantages. While managing Spotlight from System Preferences ensures that there’s always a running tab of what’s hidden from Spotlight search, it’s much simpler to toss a file into an unsearchable folder when working quickly. The file rename method can be performed remotely or as part of an Automator workflow, so it can prove more versatile than the System Preferences method in certain circumstances.
It’s important to remember that none of these methods truly “hides” anything, and all of my files will still be visible to anyone who looks hard enough. To encrypt or further obscure files, look to FileVault in Mac OS X or third-party applications.