I want to rename files using Ant maintaining their directory structure.
e.g. Assume following directory structure:
- copy
- new
- testthis.a
Using code below, I could rename files containing "this" word to "that.a" using copy task, but they all are getting pasted into "paste" directory loosing their directory structure.
<copy todir="paste" overwrite="true">
<fileset dir="copy"/>
<regexpmapper from="^(.*)this(.*)\.a$$" to="that.a"/>
</copy>
Output:
- paste
- that.a
If I change regexmapper to (notice \1 before that.a):
<regexpmapper from="^(.*)this(.*)\.a$$" to="\1that.a"/>
It's generating correct directory structure but always prepends word before "this" to "that.a"
Output:
- paste
- new
- testthat.a
Is there any way to rename files maintaining their directory structure without pre-pending or appending any word?
Is there any other mapper which can be used for the same?
Any help would be appreciated.