Re: [dev] alternatives to find for querying the filesystem

From: Raphaël Proust <raphlalou_AT_gmail.com>
Date: Thu, 12 Dec 2013 20:49:25 +0000

On Thu, Dec 12, 2013 at 7:36 PM, Chris Down <chris_AT_chrisdown.name> wrote:
> On 2013-12-12 14:32:03 -0500, Andrew Gwozdziewycz wrote:
>> So, to find all files in /etc modified within the last hour...
>>
>> walk /etc | agep -1H -
>>
>> Or,
>>
>> walk /etc | xargs agep -1H
>
> The problem here is speed. For any non-trivial number of files, this
> will become non-negligibly slower due to the number of stat family calls
> required (and the cost of reinterpreting the data each time).


What about having said tools *and* a mini interpreter (for when speed matters).

wafi: walk and friends interpreter

% wafi "walk foo/bar/ | agep -1H - | permp +ox -"

would be a fast equivalent to

% walk foo/bar/ | agep -1H - | permp +ox -

You could even chain with non interpreter-supported filters:
% wafi "…" | whatever | wafi "…"


The advantage of this wafi (really needs a better name if it is ever
implemented) is that the syntax for the supported mini-language is a
dumbed down shell!

The main inconvenient is the quoting nightmare…


-- 
______________
Raphaël Proust
Received on Thu Dec 12 2013 - 21:49:25 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 12 2013 - 22:00:08 CET