I am trying to delete list of files using Ant 1.6.5 , but I have to put a condition that if only the file exists delete it or else throw a build failure error to user, I have got the below snipped from the forums here , but when i modify accordingly in my environment it is not working.
<property name="file.list" value="test1.props,test2.props,test3.props"/>
<target name="file.missing" depends="validate.dir">
<echo message = " The Filelist is : ${file.list} "/>
<condition property="is.missing">
<resourcecount when="ne" count="0">
<difference id="is.missing">
<intersect>
<filelist id="required" dir="${target.location}" files="${file.list}"/>
<fileset id="existing" dir="${target.location}" includes="*.*"/>
</intersect>
<filelist refid="required"/>
</difference>
</resourcecount>
</condition>
<fail if="is.missing" message= " File ${toString:missing} is missing from the list of files provided for removing, please recheck and submit correct "/>
</target>
<target name = "clean" unless="is.missing" depends="file.missing">
<delete>
<fileset dir="${target.location}" includes = "${file.list}"/>
</delete>
</target>
i am getting a compile time error with this code , and the error is Class org.apache.tools.ant.taskdefs.ConditionTask doesn't support the nested "resourcecount" element.
Can some one please guide me on this