Suppose I have
/Root
/A
/to_delete
/not_to_delete
/B
/to_delete
/not_to_delete
/C
/to_delete
/not_to_delete
How to delete those folders called "to_delete" in Ant?
Please check this :
http://ant.apache.org/manual/Tasks/delete.html
If you don't want to specify A, B, C you will have to do some nasty trict for recursively searcing all subdirectories. I have done this with a custom java script.
If you can specify A,B,C though you just need something :
<delete includeEmptyDirs="true">
<fileset dir="root" includes="**/to_delete/"/>
</delete>
Please try the below code and it works to remove the dir and sub dirs as well.
<delete includeEmptyDirs="true">
<fileset dir="${dir.to.delete}">
<include name = "**" />
<exclude name = "**/.svn" /> <!-- in case you want to skip .svn folders to avoid SVN conflicts -->
</fileset>
</delete>
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