Re: exclusion in file patterns
Bram Moolenaar <[email protected]>
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
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.
> 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.
> 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.
> 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.
> The rglob/tree function definitely is useful, I think.
I suppose so. Something similar was recently mentioned on the SCons
maillist.
> > "Software is like sex... it's better when it's free."
> > -- Linus Torvalds, initiator of the free Linux OS
> > Makes me wonder what FSF stands for...?
>
> Where can I sign up?
Ask RMS!
- Bram
--
This message contains 78% recycled characters.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf