ANT select a file based on pattern, move to dest and rename
===

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"> 
                                -- pick all the xml files in that directory
			<fileset  dir="bin-debug" includes="**/*.xml"> 
                                         <or>
                                            -- see if it ends with _qa.xml if present copy
				 <filename name="*_${env}.xml"/> 
                                           -- else select any xml file present in that dir andcopy  to dest
                                            <filename name="*.xml" />
                                          </or>
			</fileset>
	</copy> 
	<echo> done copying files </echo>
</target>'



