16

How can I rename 1..n file with ANT? I would like to rename any files with xxxx.default.properties to xxxx.local.properties.

Thank you.

2 Answers 2

29

Using the move task you could do something like this:

  <move todir="my/src/dir" includeemptydirs="false">
    <fileset dir="my/src/dir"/>
    <mapper type="glob" from="*.default.properties" to="*.local.properties"/>
  </move>

Give it a try and let us know.

2
  • Can we use Regular Expression in from and to ?
    – Anand
    Commented Dec 21, 2012 at 11:42
  • @unkwn yes. you can use a regexmapper Commented Apr 25, 2014 at 20:28
2

Use the move-task. There is also an example how to rename a set of files (last examples).

1
  • Danke! I'm using the move-task. See OscarRyz' answer.
    – Thomas
    Commented Nov 19, 2010 at 13:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.