I'm trying to copy files under all the directory startting at the root folder that ends with _${env}.xml and strip the _${env} from the filename if found or copy the xml file whichever is present in the directory.I can't get this to work please help.(possibly i need a move and mapper to rename and I somehow can't weave them together.)
<target name="main">
<copy todir="qa-wprelease">
<fileset dir="bin-debug" includes="**/*.xml">
<or>
<filename name="*_${env}.xml"/>
<filename name="*.xml" />
</or>
</fileset>
</copy>
</target>
Check the manual of <copy>
task -- <copy>
can take a <mapper>
as nested element, which can change your filenames during copy with a pattern. <mapper>
has many types, with some of them you can even use javascript to change your filename.
So... Maybe you can do it this way (not tested so not sure if it works):
<copy todir="qa-wprelease" includeemptydirs="false">
<fileset dir="bin-debug" includes="**/*.xml" />
<globmapper from="*_${env}.xml" to="*.xml"/>
</copy>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With