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


Click here to return to the 'Make the locate command ignore certain directories' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Make the locate command ignore certain directories
Authored by: bluehz on Nov 15, '03 08:24:22AM
thx cilly for that info on /etc/locate.rc. It does sound like that shoudl be the place to put pruned dir. Can you give us a little info on the format for the /etc/locate.rc file. By default there is no locate.rc file so I am not sure of the syntax of this file. Quick search on Google yields this info - looks like it could be used (not this is for OpenBSD - DO NOT USE WITHOUT MODIFYING):
#       $OpenBSD: locate.rc,v 1.1 1996/08/17 01:30:25 michaels Exp $
#
# /etc/locate.rc -  command script for updatedb(8)
#
# $Id: locate.rc,v 1.1 1996/08/17 01:30:25 michaels Exp $

# temp directory
TMPDIR="/var/tmp"

# the actual database
FCODES="/var/db/locate.database"

# directories to be put in the database
SEARCHPATHS="/"

# directories unwanted in output
PRUNEPATHS="/tmp /usr/tmp /var/tmp /a /b /c /d /kern /proc /portal /p /fd /mnt /mnt2 /cdrom /root /u /obj /usr/obj /var/obj"

# filesystems allowed. Beware: a non-listed filesystem will be pruned
# and is the SEARCHPATHS starts in such a filesystem locate will build
# an empty database
#
# be carefully if you add 'nfs'
FILESYSTEMS="local" 


[ Reply to This | # ]
Make the locate command ignore certain directories
Authored by: cilly on Nov 15, '03 10:21:22AM
This looks good!

I would use the full path: /private/var/db/locate.database Just to make sure it will work if the alias is broken.

You only need to add i.e. /Volumes to the prunepath value, or any other path you want to excempt.

---
cilly

[ Reply to This | # ]

Make the locate command ignore certain directories
Authored by: jyu on Nov 15, '03 05:29:09PM

Where does /etc/locate.rc come from? I have 10.2 and 10.3, but couldn't find this file on either system. I think that's the reason the hint poster didn't use it.



[ Reply to This | # ]
Make the locate command ignore certain directories
Authored by: bluehz on Nov 15, '03 06:32:54PM

The locatedb.rc does not exist and as a previous poster noted - I don't think the version of locate included with OS X or Fink is taking into acct the locatedb.rc by default. I tried the format above and told it to prune my "Previous Systems" dir and it did not. So it looks like the rc is not being used. I don't even see a cmdline switch to get locate.updatedb to read in teh configs from locatedb.rc.



[ Reply to This | # ]
Make the locate command ignore certain directories
Authored by: cilly on Nov 15, '03 08:00:40PM

do man locate.updatedb and you will see it is locate.rc !

---
cilly @ http://www.cilly.dyndns.org/



[ Reply to This | # ]
Make the locate command ignore certain directories
Authored by: bluehz on Nov 15, '03 10:49:56PM

Actually locate.rc is what I used - I just typed it wrong above. Still not observing my prefs in /etc/locate.rc



[ Reply to This | # ]