ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Alberto Fernandez <>
Subject Re: Objections against advanced directory scanning
Date Tue, 01 Feb 2000 00:03:11 GMT wrote:

> "The scanner itself is in a helper class called DirectoryScanner. For now,
> the only directory scanning related  'behaviour' in the Tasks are the
> setIncludes, setExcludes and setDefaultexcludes (and of course a call in
> the execute method)."
> Excellent! molto +1's
> "The '**' is needed to cater for the following situations:
> 1. match files in 1 directory, but not it's subdirectories. e.g.
> /test/*.java which matches all .java files in the /test/ directory.
> 2. match files in 1 directory, and all (or a subset of) it's
> subdirectories.
> e.g. /test/**/*.java which matches all .java files in all directories under
> /test/.
> 3. match directories on the leafs of the tree e.g. **/CVS/* which matches
> all CVS directories and their files.
> If you don't have an extra special character ('**') besides the usual '*'
> and '?', it is impossible to cater for all described situations.
> If you can show me how to do it without '**', please tell me. I would be
> very grateful."
> Infozip does this with a "recurse into directories' flag (-R), that is used
> in combination with the mask to determine which files are selected.
> Does the following cover things (it does as far as I can tell).
> 1) Includes="/test/*.java" recurse="false"
> 2) Includes="/test/*/*.java" recurse="true"
> 3) Includes="*/CVS/*" recurse="true"

This requires more typing than '**' is not near as expressive. The problem with
'*' is that it does not matches '/' which is the directory separator. So '**'
is just shorthand for the regular expression "([^/]*/)*".

Notice that on your your rule (3) there is no way to write a rule that only
takes one of this two files:
 (a) a/b/c/CVS/d
 (b) a/CVS/b/c/d

With '**' the rules are:
 (a) **/CVS/*
 (b) */CVS/**

It seems to have more expressive power.

Jose Alberto
 Jose Alberto Fernandez               500 Oracle Parkway, M/S 9op4
 Development Manager                  Redwood Shores, CA 94065
 ORACLE Corp.                         Phone: (650) 506-8830
 Java Products Group                  Fax: (650) 506-7303
 Languages & Obj-Relational Tech      Email:

View raw message