Hello, On Wed, Sep 09, 2009 at 11:55:48AM +0200, Carl Fredrik Hammar wrote: > On Wed, Sep 09, 2009 at 12:28:28AM +0300, Sergiu Ivanov wrote: > > On Tue, Sep 08, 2009 at 01:55:41PM +0200, Carl Fredrik Hammar wrote: > > > > 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. [...] > Your mail gave me the impression that you wanted to iterate through all > files in the directory tree but stopping no deeper than the number of > components in the pattern.
> However, both this and my proposal (which you really intended), is > just as efficient as the original implementation. Matching PATTERN > under all directories in stow, is equivalent to matching `*/PATTERN' > in these implementations. All proposed implementations would iterate > the same number of directories, and filter the same number of paths. This would be true, if the original pattern-matching feature implementation could correctly interpret multi-component patterns. However, AIUI from the source code, the existing version simply iterates all sub-directories of stow/*/ and tries to match their names against the pattern. I compared the implementation that could deal with multi-component patterns with the original implementation of the pattern-matching feature and came to the conclusion multi-component pattern support would require more effort. I hope I understood what you had said correctly. Regards, scolobb