Mac OS X Server version 10.5: How to prevent Spotlight from indexing certain directories

In Mac OS X Server version 10.5 Leopard, you have the ability to enable Spotlight indexing on sharepoints. Some sharepoints may contain directories that you want to exclude from indexing. These directories may include items such as print spools, mail storage and scratch files used in work-flow.

In order to prevent Spotlight from indexing a directory, append ".noindex" to the name. For example:

/Volumes/Server HD/Shared/printer.noindex/main-spool

In the example above, nothing below the printer.noidex directory will be indexed.

If appending ".noindex" to the path causes issues for a particular application, you can use a symbolic link to designate an appropriate path.

For example, if your printing application expects to find its spool at (/Volumes/Server HD/Shared/spool), you can create the ".noindex" directory and a symbolic link that will allow everything to function properly:

mkdir "/Volumes/Server HD/Shared/spool.noindex"
ln -s "/Volumes/Server HD/Shared/spool.noindex/"    "/Volumes/Server HD/spool"


ls -l would show the following:

lrwxr-xr-x   1 admin admin      13 Sep 25 12:58 spool -> spool.noindex
drwxr-xr-x  2 admin admin      68 Sep 25 12:58 spool.noindex


Spotlight will recognize that the "real" path is "spool.noindex" therefore, the "spool.noindex" directory will not be indexed, while the application will look for the "spool" path and work as expected.

Published Date: Feb 20, 2012