|
@@ -290,6 +290,10 @@ |
|
|
<li><a href="#delete-directory-children-only"> |
|
|
<li><a href="#delete-directory-children-only"> |
|
|
How can I delete everything beneath a particular directory, |
|
|
How can I delete everything beneath a particular directory, |
|
|
preserving the directory itself? |
|
|
preserving the directory itself? |
|
|
|
|
|
</a></li> |
|
|
|
|
|
<li><a href="#delete-directory-only-if-empty"> |
|
|
|
|
|
How can I delete a particular directory, |
|
|
|
|
|
if and only if it is empty? |
|
|
</a></li> |
|
|
</a></li> |
|
|
</ul> |
|
|
</ul> |
|
|
<h4 class="toc">It doesn't work (as expected)</h4> |
|
|
<h4 class="toc">It doesn't work (as expected)</h4> |
|
@@ -1166,6 +1170,22 @@ shell-prompt> m4 foo.m4 > foo |
|
|
<delete includeemptydirs="true"> |
|
|
<delete includeemptydirs="true"> |
|
|
<fileset dir="dirtokeep" includes="**/*" /> |
|
|
<fileset dir="dirtokeep" includes="**/*" /> |
|
|
</delete> |
|
|
</delete> |
|
|
|
|
|
</pre> |
|
|
|
|
|
<p class="faq"> |
|
|
|
|
|
<a name="delete-directory-only-if-empty"></a> |
|
|
|
|
|
How can I delete a particular directory, |
|
|
|
|
|
if and only if it is empty? |
|
|
|
|
|
</p> |
|
|
|
|
|
<p>Most users who go down this path have no problem figuring |
|
|
|
|
|
out that |
|
|
|
|
|
<code><delete includeemptydirs="true" /></code> will |
|
|
|
|
|
help them. The seemingly tricky part is preserving the |
|
|
|
|
|
non-empty directories, which Ant includes in the directory |
|
|
|
|
|
scan. Fortunately the answer is simple:</p> |
|
|
|
|
|
<pre class="code"> |
|
|
|
|
|
<delete includeemptydirs="true"> |
|
|
|
|
|
<fileset dir="dirtokeepifnotempty" excludes="**/*" /> |
|
|
|
|
|
</delete> |
|
|
</pre> |
|
|
</pre> |
|
|
<p class="faq"> |
|
|
<p class="faq"> |
|
|
<a name="general-advice"></a> |
|
|
<a name="general-advice"></a> |
|
|