Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the '10.4: Configure Spotlight to index excluded directories' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Configure Spotlight to index excluded directories
Authored by: ptejad on May 13, '05 07:36:35PM
Here is a one-liner that will search out all Text files on your drive and set the filetype to TEXT. Modifying what the grep(s) search for and the "TEXT" part of SetfFile this one liner can be used for other types of files that the "file" command can distinguish. Nake sure you use the "file" command to see what it outputs for the type of file you want to change, and use GetFileInfo on example file of that type to see the four-char code needed.

find -x / -type f -print0 | xargs -0 -L 1 file | grep "ASCII" \
| grep "text" | awk -F":" '{print $1}' | grep "/" \
| xargs -n 1 -t -J % /Developer/Tools/SetFile -t "TEXT" "%"

[ Reply to This | # ]
10.4: Configure Spotlight to index excluded directories
Authored by: kirkmc on May 14, '05 05:37:34AM

Spotlight doesn't index TEXT files just because their type is TEXT; they must have the .txt extension.

Read my blog: Kirkville --
Musings, Opinion and Miscellanea, on Macs, iPods and more

[ Reply to This | # ]
10.4: Configure Spotlight to index excluded directories
Authored by: zakwilcox on May 06, '09 11:40:47AM

Thanks for this sub-hint. I'm a pikey who's still on 10.4 and I use a personal wiki to keep random notes. I set up MediaWiki on the system Apache install yonks ago, but it got annoying lately that Spotlight didn't index it. I installed MoinMoin Desktop Edition thinking its plain text files would be the answer but Spotlight didn't seem to index the files except the metadata. Running SetType -t TEXT on the "pages/*/revisions/" trees fixed the problem (which would seem to contradict kirkmc's comment). It's still not perfect - every time you add a new page or edit an existing one you have to set the type on the new file. I'll address this with a cron job to pick those up every hour or so, and just hope that anything I've been editing/creating more recently than that is fresh in my mind anyway :)

I expect that in 10.5 there's a way to write a plugin to feed Spotlight the right data without this hack (perhaps even linkifying the results so they're URLs), or a way to simply configure Spotlight differently, but by now I think I'm better off waiting for 10.6.

[ Reply to This | # ]