mulle-spotlight-utilities.sh
96694bfe
 #! /bin/sh
 # ######################################################################
 # Coded by Nat!
 # 2013 Mulle kybernetiK  http://www.mulle-kybernetik.com
 # 
 # $Id$
 #
 spotlight_check()
 {
    for i in /Volumes/*
    do
       echo "$i:" `(mdutil -s "$i" | tail -1)` "Size:" `(du -sh "$i"/.Spotlight-V100 | awk '{ print $1 "." }')` `[ -x "$i"/.Spotlight-V100/Store-V1 ] && echo "$i/.Spotlight-V100 contains obsolete Store-V1."`
    done
 }
 
 
 spotlight_rebuild()
 {
    for i in /Volumes/*
    do    
       enabled=`(mdutil -s "$i" | tail -1 | awk '{ print $2 }')`
       mdutil -i off "$i"
       rm -rf "$i/.Spotlight-V100"
       if [ "$enabled" = "enabled." ]
       then
          mdutil -i on "$i"
       fi
    done
 }
 
 
 spotlight_utilities()
 {
    spotlight_check
 }
 
 `basename $0 | tr '-' '_' | sed 's/mulle_\(.*\).sh/\1/g'`