Export to GitHub

macfuse - MACFUSE_FS_SPOTLIGHTFS.wiki


The Spotlight File System for MacFUSE

To use the MacFUSE version of the SpotlightFS file system, you must have the MacFUSE package installed. Please read the QUICKER_START_GUIDE document to learn how to install that package.

Introduction

SpotlightFS is a MacFUSE file system that creates true smart folders, where the folders' contents are dynamically generated by querying Spotlight. This differs from Finder's version of smart folders, which are really plist files with a .savedSearch file extension. Since SpotlightFS smart folders are true folders, they can be used from anywhere--including the command line.

Using SpotlightFS

Using SpotlightFS is as easy as creating and opening a folder. For example, if I want a folder that contains all documents about Google, I can simple create a folder at the top level of my SpotlightFS volume, and name it "Google". The contents of that folder will be symbolic links to all the files on my computer which match a Spotlight query of "Google".

This even works from the command line. For example, I could do the following. $ mkdir /Volumes/SpotlightFS/Hasselhoff $ ls -lrt /Volumes/SpotlightFS/Hasselhoff [... output omitted to avoid embarrassment ...]

And of course, you can do more complex searches such as:

ls "kMDItemContentType=='com.adobe.pdf' && kMDItemFSName=='*some*pattern*'"

The "SmarterFolder"

As its name implies, this folder is similar to a smart folder, except that it's even smarter. It's smarter because you can view the contents of smart folders which don't even exist. For example, if you navigate in the finder to the "SmarterFolder" on your SpotlightFS volume, you'll see a seemingly empty folder. However, if you now navigate Finder's menu to "Go > Go to Folder..." (or hit cmd+shift+g) and type the name of a folder to go to, you'll magically be presented with the contents of that folder.

This is even more useful when used from the command line. So, instead of the previous command line example, I could have simply done the following.

$ ls -lrt /Volumes/SpotlightFS/SmarterFolder/Hasselhoff [...]

Integration with Regular Smart "Folders"

You may notice that some folders show up in purple and look like the standard Finder smart folders. This is because they are. SpotlightFS looks in ~/Library/Saved Searches for other saved searches, and if any are found, they are added to the display in SpotlightFS. This is so these saved searches, which technically aren't folders, can be used just like real folders; from the command line and all.