bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: limiting the directory to locate and search by file type


From: Peng Yu
Subject: Re: limiting the directory to locate and search by file type
Date: Tue, 8 Nov 2011 06:25:59 -0600

On Tue, Nov 8, 2011 at 3:40 AM, James Youngman <address@hidden> wrote:
> On Tue, Nov 8, 2011 at 12:11 AM, Peng Yu <address@hidden> wrote:
>> On Mon, Nov 7, 2011 at 5:47 PM, James Youngman <address@hidden> wrote:
>>> You can achieve this by using locate --regex.
>>
>> Suppose I want to restrict the search to /tmp, what regex I should specify?
>
> locate --regex '^/tmp\($\|/\)'

So if I want to search for some file pattern, I have to combine the
regex for the file pattern with the directory regex into a single
regex. What seems missing in locate is the operator like -and -or that
are found in find. Since locate can be thought of a faster version
find. I'd think the command line interface for 'locate' should be as
close to 'find' as possible

> I'm not working on it right now.   But I think that it's a good idea
> to move in this direction (and caching directory-level information
> will also probably allow us to speed up indexing).  Would you like to
> work on this?

I looked at the source code of updatedb. It essentially use find to
generated the database and use frcode to compress the database, where
the directory info should be add to the database? frcode is natural to
compress strings with common suffix, is it also applicable when there
is additional directory information?

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]