[Top][All Lists]

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

RE: "insert" or "remove" a filename from locatedb

From: Gary Hassani
Subject: RE: "insert" or "remove" a filename from locatedb
Date: Tue, 30 Jul 2013 12:33:05 -0500


Thanks James,  That sounds workable.  


In the interest of efficiency do you have any suggestions regarding a program 
that would directly read and update the locatedb?   Something like:


1.   Read the ‘old’ locatedb up to the filename that is to be ‘deleted’ while 
writing out ‘new’ locatedb as you go.

2.   Skip the filename to be ‘deleted’

3.   Resume reading ‘old’ and writing ‘new’ locatedb to eof


Or would this break some compression or formatting protocol within locatedb?    




On Tue, Jul 30, 2013 at 4:22 PM, Gary Hassani < <mailto:address@hidden> 
address@hidden> wrote:



> Anyone of a way (program) that will 'insert' or 'delete' a file from a 

> locatedb?


locate won't support in-place modification of its database.  But you

can re-write it.   For example, you can dump al the entries in the

database with


locate --null --regex ""


And then edit the resulting stream of (NUL-terminated) paths to omit

any items you want to delete.   You then feed the stream to frcode to

generate a new database.  See the updatedb shell script for details.

Adding files would be similar, though for that case you also need to ensure 
that the file list is sorted.







> In other words. given a locatedb and a filename is it possible to 

> insert that filename into the locatedb?


In general there may not be a "the" locatedb since multiple databases are 





> Similarly given a locatedb and a filename is it possible to remove 

> that filename from the locatedb ?


> Thanks very much.







reply via email to

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