This ANT delete task functions perfectly if the directory contains either FOO.xml or BAR.xml (or both), but will not return successfully if they do not exist.
<delete includeemptydirs="true" followsymlinks="false">
<fileset dir="${apache.base}" erroronmissingdir="false">
<include name="**/*"/>
<exclude name="**/FOO.xml **/BAR.xml"/>
</fileset>
</delete>
Is there a way I could have it work regardless of whether the exclude section of the fileset is empty or not?
Your exclude pattern contains incorrect syntax. When using nested
includeorexcludeelements, file name patterns need to be listed separately, as such:However, if you use
fileset'sincludesorexcludesattributes, a comma-delimited list will actually work;