scarecrow-
scarecrow-

Reputation: 86

What is **/*.fileExtension used for in ant?

I can't find a direct definition of how this works? Is it a regex of some type?

for ex.

<ftp action="del"
   server="ftp.apache.org"
   userid="anonymous"
   password="[email protected]">
<fileset>
  <include name="**/*.tmp"/>
</fileset>

what is the include name = double asterisks used for?

How is it different from this

 <ftp action="list"
   server="ftp.apache.org"
   userid="anonymous"
   password="[email protected]"
   listing="data/ftp.listing">
<fileset>
  <include name="**"/>
</fileset>

Upvotes: 0

Views: 19

Answers (1)

greg-449
greg-449

Reputation: 111218

These are what Ant calls 'patterns' and are similar to file patterns in Unix with the addition of the '**' pattern.

A single * matches zero or more characters, ? matches one character.

When ** is used as the name of a directory in the pattern, it matches zero or more directories. For example: /test/** matches all files/directories under /test/

So

<include name="**/*.tmp"/>

matches any file ending in .tmp in any directory

<include name="**"/>

matches anything.

A longer description is here

Upvotes: 1

Related Questions