F.7 GlobMapper

The GlobMapper works like the copy command in DOS:

<copy todir="/tmp">
  <mapper type="glob" from="*.php" to="*.php.bak"/>

  <fileset refid="someid" />
</copy>

This will change the extension of all files matching the pattern *.php to .php.bak.

Table F.7:  The globmapper mapper can take the following extra attributes.

NameTypeDescriptionDefaultRequired
handledirsepStringIf this is specified, the mapper will ignore the difference between the normal directory separator characters - \ and /. This attribute is useful for cross-platform build files.falseNo
casesensitiveBooleanIf this is false, the mapper will ignore case when matching the glob pattern.trueNo

F.7.1 Examples

<mapper type="glob" from="*txt" to="*txt.bak"/>

Applying the mapper, you will get the following results from the following filenames:

Table F.8: Result of mapping

FromTo
test.txttest.txt.bak
./foo/bar/test.txt./foo/bar/test.txt.bak
mytxtmytxt.bak
SomeClass.phpignored, SomeClass.php