[Top][All Lists]

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

Re: [PATCH] Apply pattern-matching immediately beneath the stow directo

From: hammy . lite
Subject: Re: [PATCH] Apply pattern-matching immediately beneath the stow directory.
Date: Tue, 8 Sep 2009 15:34:38 +0200


On Tue, Sep 8, 2009 at 1:55 PM, Carl Fredrik Hammar wrote:
>> Do you have some general idea of how multi-component pattern matching
>> could be implemented more efficiently than that?  Some vague pointer
>> should suffice for me to adapt the idea to unionfs.
> How about matching one component at a time?
> For instance, given `*/*/*' you iterate through all files in the
> current directory and find matches to `*/' (the slash filters out
> non-directories).  For each match you recurse, making the match the
> current directory and with the pattern with the tested component removed,
> e.g. `*/*'.  The recursion continues until the pattern is static or
> there are no matches.
> (Clarification: by current directory I don't mean the process' CWD,
> just the directory currently being iterated.)

Just realized that there are many programs that do this pattern matching,
and indeed glibc's glob() does exactly this.  It even has some extensions
so that it can be used on structures other than directories.

Forget what I said and just use glob().


reply via email to

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