I'm look for a way, with using ant "out of the box", to find a list of
directories and sort them via date then deleted the oldest three
directories.
Thus far I've been able to sort the directories, take the last three but
I can't seem to figure out how to delete the actual directory; see
attached build.xml for an example of how far I've gotten.
<project name="project-deletion" default="build">
<property name="base.dir" value="/srv/jboss" />
<property name="module.name" value="myProject" />
<target name="build">
<antcall target="clean" />
</target>
<target name="get-count">
<condition property="should.clean">
<resourcecount when="greater" count="8">
<fileset dir="${base.dir}">
<include name="*-${module.name}/prefix.properties" />
</fileset>
</resourcecount>
</condition>
</target>
<target name="clean" depends="get-count" if="should.clean">
<delete includeemptydirs="true">
<first count="3">
<sort>
<fileset dir="${base.dir}">
<include name="*-${module.name}/*" />
</fileset>
<date xmlns="antlib:org.apache.tools.ant.types.resources.comparators" />
</sort>
</first>
</delete>
</target>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]