On Apr 3, 6:25 pm, John Machin <sjmac...@lexicon.net> wrote: > The format appears to be documented > e.g.http://www.delorie.com/gnu/docs/findutils/locatedb.5.html > and thus should be found on the locatedb(5) man page on your system.
More comprehensive: http://www.gnu.org/software/findutils/manual/html_node/find_html/Database-Formats.html#Database-Formats > Assuming that you don't have the old version, it should take about 20 > lines of Python to loop around extracting the file names, plus some > more to open the file, read it in as one big string (how big is it?), > and check the dummy "LOCATE02" entry up the front -- it's a bit hard > to be sure how the prefix length of the first non-dummy entry is > determined without seeing an actual example, but my guess is that the > file will start like this: > > "\x00LOCATE02\x00\xF8name-of-first-file-in-full\x00........." > where the "\xF8" is -8 meaning ignore the 8-character previous name > "LOCATE02" i.e. previous name can be regarded as "". After noticing there was in fact an example, make that: "\x00LOCATE02\x00\x00name-of-first-file-in-full\x00........." i.e. you can assert that buffer[:10] == "\x00LOCATE02\x00" and start the loop from offset 10 with the previous name set to "". Cheers, John -- http://mail.python.org/mailman/listinfo/python-list