Hello, On Tue, Sep 08, 2009 at 01:55:41PM +0200, Carl Fredrik Hammar wrote: > On Mon, Sep 07, 2009 at 11:24:48PM +0300, Sergiu Ivanov 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.)
That's exactly what I was talking about. (Though I forgot to mention some details you have mentioned.) I just wanted to say that it is not really efficient. But, as I've said in another mail, I guess I should think about efficiency differently in this case. My initial goal was to just modify the target of pattern-matching a bit. I guess the extending the functionality would be okay. Regards, scolobb P.S. Sorry for eventual bad sentence formulation in this and other letters I've posted recently: it's late here and I need to answer the mails today, since I'm leaving tomorrow, as I have already announced.