How to stop updatedb from indexing backup drive?
Has anyone figured out how to stop locate.updatedb from indexing one's backup drive? Currently /usr/bin/locate doubles its results, once from Macintosh HD and once from Backup HD. I already have Backup HD blocked from indexing by Spotlight, but that doesn't seem to affect locate.
A quick search gives this MacOSXhint, "Prevent locate's update from updating certain folders," but that refers to locate.updatedb running as a cron job, which it no longer does, so I'm reluctant to apply the hint. It also looks muy complicated. :o If no one can help me out, I'll post whatever answer I come up with -- eventually. |
OK. It looks like locate.updatedb isn't fully implemented in OSX. It doesn't pay attention to options about excluding paths from indexing.
Here's another MacOShint that's more on target: Make the locate command ignore certain directories. What I tried first is Code:
$ sudo /usr/libexec/locate.updatedb ---prunepaths=/Volumes/Backup\ HD/ I then found a thread on MacOSX.com suggesting that OSX doesn't pay attention to prunepaths, locate.updatedb's options not working. (Scroll down to cilly's post.) I'm left with editing Apple's locate.updatedb script, which I'm not willing to do, or living with long results from locate queries. There is another possibility: Does anyone know what the alias would look like (in my .bashrc) to redefine 'locate' to filter out /Volume/Backup\ HD? Something with grep?I suppose I could also backup to a sparseimage in Backup HD. |
Are you trying to prevent multiple entries in Open With? Because that's not done with locate... it's done with LaunchServices.
|
No, I'm trying to prevent the shell command 'locate' from returning two entries for every match, one from Macintosh HD and another from Backup HD. It's really a MacOSX or Unix question. Its relation to SuperDuper! is that the only reason I have backup drive is because of your excellent program.
I've figured out the command sequence to filter out the results in the backup drive Code:
locate SOMESTRING | grep -vw \/Volumes\/Backup\ HD |
Just wanted to make sure...
|
Whew! Here's the line to add to .bashrc to redefine 'locate' so it excludes everything on the backup drive:
Code:
# Exclude the backup drive from locate's results I'm not quite sure if it should be '$1', '$*' or '$@'. '$1' seemed safest. |
All times are GMT -4. The time now is 11:09 AM. |
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.