Macs in Chemistry

Insanely great science

 

Spotlight Tips

Preventing Spotlight Indexing files.

Sometimes during my work I generate large files containing descriptors for molecules that I use for building comutational models predicting a particular biological activity. These files can be very large and contain little other a series of numbers that have no relevance outside the computational model. Unfortunately if left to its own devices Spotlight continues to index this vast amount of data. There are two ways you can stop Spotlight indexing particular files or folders, you can use the "Privacy" tab in the Spotlight control panel.

As an alternative in order to prevent Spotlight from indexing a directory, append ".noindex" to the name. For example:

/Volumes/Server HD/Shared/chemicaldescriptors.noindex/fragmentscreen.tab

In the example above, nothing below the chemical_descriptors.noidex directory will be indexed. If you add .noindex to an existing folder you may need to Erase and Rebuild the index using the Terminal command:-

sudo mdutil -E /pathtovolume

mdutil has a number of other useful functions shown below.

As an alternative in order to prevent Spotlight from indexing a directory, append ".noindex" to the name. For example:

/Volumes/Server HD/Shared/chemicaldescriptors.noindex/fragmentscreen.tab

In the example above, nothing below the chemical_descriptors.noidex directory will be indexed. If you add .noindex to an existing folder you may need to Erase and Rebuild the index using the Terminal command:-

sudo mdutil -E /pathtovolume

mdutil has a number of other useful functions shown below.

Usage: mdutil -pEsa -i (on|off) volume ... Utility to manage Spotlight indexes. -p Publish metadata. -i (on|off) Turn indexing on or off. -E Erase and rebuild index. -s Print indexing status. -a Apply command to all volumes. -v Display verbose information.

In particular the command to switch off indexing whilst it is in progressing.

<code>sudo mdutil -i off /path_to_volume</code>

One issue that might arise is if the presence of .noindex in a file path may cause an issue. One solution is to use a symbolic path.

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

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