Re: Wildcards, ant/zsh style
Bram Moolenaar <[email protected]> Fri, 10 Sep 2004 12:53:57 +0200
| Newsgroups | gmane.comp.tools.aap.user |
|---|---|
| Message-ID | <[email protected]> |
Tim Hemel wrote:
> This is what I wrote to overcome the problem:
>
> :python
> def rlist(dir, pattern = r'.*', exclude = r'^$'):
> """recursively list all files in dir, matching the regexp
> pattern. Dirs that match the regexp exclude will not be
> traversed. The resulting filenames are relative to dir, i.e.
> dir will have to be prefixed."""
[...]
> You can use it like this:
>
> WebFiles = `rlist('website', '.*', '^(.*/)?CVS$')`
>
> This will get all files that match anything (.*) but it will exclude CVS
> directories. Syntax for the patterns is regexp.
Wouldn't these Aap commands do the same:
files =
:tree website {filename = .*} {skipdir = CVS}
files += $name
The advantage of :tree is that it offers more options and can be used
for other purposes (e.g. execute an arbitrary command for each match).
--
The war between Emacs and Vi is over. Vi has won with 3 to 1.
http://www.ssc.com/lg/issue30/raymond.html
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php