How can I make locate/updatedb ignore certain file extensions?

2

0

For instance, I don't want either program to find files that end in *.pyc. I'm sure I can do this somehow using regexes or globs, but is there a way to make locate just ignore the files altogether? It's highly doubtful that I would ever want to search for a pyc file.

Jason Baker

Posted 2009-10-02T14:51:20.970

Reputation: 6 382

Answers

9

In updatedb.conf, uncomment the PRUNENAMES line and add the extension .pyc. On my Ubuntu system by default it reads:

# PRUNENAMES=".git .bzr .hg .svn"

Change it to

PRUNENAMES=".git .bzr .hg .svn .pyc"

CarlF

Posted 2009-10-02T14:51:20.970

Reputation: 8 576

1As it turns out, PRUNENAMES only works for directories, not for file names. – Jason Baker – 2009-11-17T15:26:42.940