[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 |
Hi,
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().
Regards,
Fredrik
- Re: [PATCH] Apply pattern-matching immediately beneath the stow directory., olafBuddenhagen, 2009/09/07
- Re: [PATCH] Apply pattern-matching immediately beneath the stow directory., Sergiu Ivanov, 2009/09/07
- Re: [PATCH] Apply pattern-matching immediately beneath the stow directory., Carl Fredrik Hammar, 2009/09/08
- Re: [PATCH] Apply pattern-matching immediately beneath the stow directory., Sergiu Ivanov, 2009/09/08
- Re: [PATCH] Apply pattern-matching immediately beneath the stow directory., Carl Fredrik Hammar, 2009/09/09
- Re: [PATCH] Apply pattern-matching immediately beneath the stow directory., Sergiu Ivanov, 2009/09/13
- Re: [PATCH] Apply pattern-matching immediately beneath the stow directory., olafBuddenhagen, 2009/09/23
- Re: [PATCH] Apply pattern-matching immediately beneath the stow directory., Sergiu Ivanov, 2009/09/23