#!/bin/bash clear echo " ################# DISABLE OR ENABLE SPOTLIGHT ################# This script will enable or disable Spotlight meta-data searching and (optionally) erase indexes on specified or all volumes. Panther-style finds by name only will still function after disabling Spotlight using this script. DISCLAIMERS: 1. This script can disable Spotlight. 2. It will (optionally) erase the Spotlight index, which disables Spotlight for a given drive on all systems. 3. Re-indexing a drive after disabling Spotlight and erasing the index can take a very long time. 4. Disabling Spotlight with this script will also disable searching by \"Entire Contents\" in Apple Mail. Use this script at your own risk. Systems Boy - March, 2006 http://systemsboy.blogspot.com ################################################################ " #### GET SPOTLIGHT STATUS #### cd /Volumes/ echo " *** NOTE: This program requires admin privileges. *** " sudo echo " *** SPOTLIGHT STATUS *** ________________________________________________________________ " sudo mdutil -s * echo " ________________________________________________________________ " echo " Choose your poison... [1] Disable Spotlight for an Individual Volume [2] Disable Spotlight for All Volumes [3] Enable Spotlight for an Individual Volume [4] Enable Spotlight for All Volumes [Ctrl-c] Quit " read poison if [ $poison = 1 ] then echo " ####### DISABLE SPOTLIGHT (INDIVIDUAL VOLUME) ROUTINE ####### Drag the volume you wish to disable into this window and press return... (Example: /Volumes/FirewireDrive)" read volume echo " Disabling Spotlight for $volume... " sudo mdutil -i off "$volume" echo " Would you also like to erase the Spotlight index (Y/N)?" read index if [ $index = y -o $index = Y ] then sudo mdutil -E "$volume" fi echo " ************************************************** Spotlight search is no longer in effect for: $volume. You may now search this volume by file name only. Have fun with your Tiger, Tiger. ************************************************** " exit 0 else if [ $poison = 2 ] then echo " ####### DISABLE SPOTLIGHT (ALL LOCAL VOLUMES) ROUTINE #######" echo " Disabling Spotlight for all volumes... " sudo mdutil -i off / /Volumes/* echo " Would you also like to erase the Spotlight index (Y/N)?" read index if [ $index = y -o $index = Y ] then sudo mdutil -E / /Volumes/* fi echo " ********************************************* Spotlight search is no longer in effect. You may now search by file name only. Have fun with your Tiger, Tiger. ********************************************* " exit 0 else if [ $poison = 3 ] then echo " ####### ENABLE SPOTLIGHT (INDIVIDUAL VOLUME) ROUTINE ####### Drag the volume you wish to disable into this window and press return... (Example: /Volumes/FirewireDrive)" read volume echo " Enabling Spotlight for $volume... " sudo mdutil -i on "$volume" echo " ****************************************** Spotlight has been enabled on the volume: $volume. Indexing should begin momentarily. It may take quite some time to complete. Have fun with your Tiger, Tiger. ****************************************** " exit 0 else if [ $poison = 4 ] then echo " ####### ENABLE SPOTLIGHT (ALL LOCAL VOLUMES) ROUTINE #######" echo " Enabling Spotlight for all volumes... " sudo mdutil -i on / /Volumes/* echo " ********************************************* Spotlight has been enabled on all volumes. Indexing should begin momentarily. It may take quite some time to complete. Have fun with your Tiger, Tiger. ********************************************* " exit 0 else echo " You did not choose from the available options. Please rerun the script to try again. " fi fi fi fi exit 0