wayned at users.sourceforge.net
Fri May 10 11:38:01 EST 2002
On Fri, 10 May 2002, Dave Dykstra wrote:
> If you dynamically created a */*/*/foo/* pattern with the number of */
> to match the current path it would only have to call fnmatch once.
That's assuming the pattern doesn't contain an interior/trailing "**"
(which could only use the try-after-each-slash loop). Also, there's no
need to tweak the pattern -- it would be the same amount of work to just
figure out where in the filename your prefix of "*/*/*/" represents and
match at that position (since we'd have to count slashes anyway). We'd
also have to be careful to ensure that there aren't any exceptional
patterns that could lead to problematical positioning.
A useful question at this point would be: Does the extra complexity
make a big enough difference to be worth it? With all of the file I/O
going on, I'm wondering if it would even be noticed.
More information about the rsync