ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject Re: Bringing up an old issue that was never addressed: includeemptydirs on delete
Date Mon, 08 May 2006 17:44:52 GMT
Yes, this is by design, counter-intuitive as it may seem ;-)

With no include patterns, the filesets selects *all* files under the
given directory, i.e. any file (isDirectory() == false) or directory
(isDirectory() == true), and then trims this list using the exclude

In your first example, your empty dirs are implicitly included, and
and later not excluded, so <delete> will get rid of them.

In your second example, your include pattern prevent the empty dirs
from being selected, because they don't match your pattern, so they
can't be deleted (the exclude patterns don't matter).

The fact that some directories might become empty once all the files
you wanted deleted are gone is of no concern to <delete>, as currently

<delete> only concerns itself with the files (files or dirs) selected
by the filesets it operates upon, so if the "empty" dirs you want
deleted are not listed by these filesets (use debug mode to see the
files selected), they won't be deleted.

Does this help? Thanks, --DD

On 5/8/06, Liz Burke-Scovill <> wrote:
> Hi, I'd like to ask the best way to address this issue. It was originally
> brought up in bug report 36048,
> , I'm bring it up
> here as opposed to, because I see this more as a further
> discussion of a task already in bugzilla  as opposed to a usage question.
> The issue is that when includeemptydirs is set to "true" on a delete, it
> does not appear to work. The first reply indicates that since the patternset
> does not include directories, so the directories should not be deleted. I
> disagree as it would seem that that would defeat the purpose of having an
> optional flag to include empty directories.
> I have also found that includeemptydirs works as indicated when an excludes
> attribute or exclude node is used with the fileset. For example:
> <delete includeemptydirs="true">
>   <fileset dir="foo" excludes="**/*.bar" />
> </delete>
> In this example, it deletes all empty directories. Using false does not
> delete empty directories, and as such it works as expected. The following
> example:
> <delete includeemptydirs="true>
>   <fileset dir="foo" includes="**/*.bar" />
> </delete>
> behaves no differently regardless of whether or not includeemptydirs is set
> to true or false. Therefore, either documentation needs to indicate this
> behavior, or it should be considered a bug (feature? ;) ) and assigned (I'd
> be willing to look at code to work on it).
> Additionally, if a delete task with includeemptydirs="true" has both
> excludes and includes in its filesets, the behavior displayed is the same as
> the second example.
> The reason I bring this up here is to further discussion. Is there a reason
> that includeemptydirs acts this way with includes? Or is it something that
> was overlooked?
> Thanks!
> Liz Burke-Scovill
> --
> Imagination is intelligence having fun...

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message