Re: exclusion in file patterns

Aschwin Marsman <[email protected]>
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
On Sat, 13 Sep 2003, Bram Moolenaar wrote:

> Tim Hemel wrote:
> 
> > It would definitely solve my recursive file selection, except for the
> > exclusion, but for that you could use another operator ('-' ?).
> > 
> > FILES= `tree("www") - tree("CVS") - tree("*.bak")`
> 
> It's not difficult to add an argument to "tree" to define an exclude
> pattern.  Also avoids having to walk the tree three times.

Sounds usefull to me. How would you specify this?
 
> > But then we have another problem, what is meant by *.bak? Just the
> > .bak files in the current directory, or everything that end in .bak ?
> 
> Both are needed.

Agreed.
 
> > I would suggest calling tree something like rglob (recursive glob), if its
> > arguments are going to include wildcards.
> 
> rglob() sounds like something that accepts "**" for a pattern:
> rglob("**/*.bak").  It's OK for how you use it above, but when adding an
> "exclude" argument I suppose it's better not to use "glob" in the name.
> It's quite an obscure name anyway.

OK.
 
> > Too bad that the - operator is not defined for lists in Python, but we can
> > probably overload it.
> 
> There is probably a good reason why it wasn't defined in Python.
> 
> It's quite easy to do all this with one tree() function that takes
> multiple arguments.

This is something I would use.
 
> > The rglob/tree function definitely is useful, I think.
> 
> I suppose so.  Something similar was recently mentioned on the SCons
> maillist.
> 
> - Bram
 
Have a nice weekend,
 
Aschwin Marsman
 
--
[email protected]              http://www.marsman.org



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.