under the src folder I have the following folders: daos, business and model,I wanna delete using ant script, all the folders except "model" so I tried:
<delete includeemptydirs="true">
<fileset dir="${basedir}/src">
<include name="**/*"/>
<exclude name="model/*"/>
</fileset>
</delete>
All the folders are deleted excpet "model" which is empty !! all its files are deleted !
Try instead
To the googlers of the future:
What worked for me:
This deleted everything (every files and directories) below
target/
, excepttarget/big_and_complex_dir
.My intended goal was to avoid the unneeded directory walkthrough, which in case of the "
big_and_complex_dir
" took very long time.It seems the fileset interpretation of ant has the non-trivial, non-intuitive behavior, that we need to close an include/exclude path with
/
if we intend to do recursive subdirectory operations as well.