And to me. I assumed that when using delete with no dir attribute and a
nested fileset would not include the base dir. After all, if one uses a
fileset in the context of a copy this is what happens. Take this build
as proof:
<project name="test" basedir="." default="all">
<property name="tmp.dir" value="tmp"/>
<property name="from.dir" value="${tmp.dir}/fromdir"/>
<property name="to.dir" value="${tmp.dir}/todir"/>
<macrodef name="setup">
<sequential>
<delete dir="${tmp.dir}"/>
<mkdir dir="${from.dir}/dir1"/>
<mkdir dir="${from.dir}/dir2"/>
<touch file="${from.dir}/file1.txt"/>
<touch file="${from.dir}/file2.txt"/>
</sequential>
</macrodef>
<target name="test-fileset-copy">
<setup/>
<copy todir="${to.dir}" includeemptydirs="true">
<fileset dir="${from.dir}"/>
</copy>
<available file="${to.dir}/fromdir" property="test.failed"/>
<fail if="test.failed" message="fromdir copied to todir"/>
</target>
<target name="test-fileset-delete">
<setup/>
<delete includeemptydirs="true">
<fileset dir="${from.dir}"/>
</delete>
<available file="${from.dir}" property="test.success"/>
<fail unless="test.success" message="fromdir deleted!"/>
</target>
<target name="all" depends="test-fileset-copy, test-fileset-delete"/>
</project>
I think that the way delete behaves here is wrong.
> -----Original Message-----
> From: Dominique Devienne [mailto:[EMAIL PROTECTED]
> Sent: Friday 12 January 2007 20:47
> To: Ant Users List
> Subject: Re: Delete the contents of a directory but not the
> directory itself
>
> > Explicitly saying includes="**/*" literally means only any file or
> > directory below the basedir of the fileset. Note that we
> welcome any
> > suggestions regarding where in the manual you might have
> hoped to find
> > this file scanning information.
>
> This thread picked my interest, because I didn't know the answer ;-)
>
> I personally assumed no includes was equivalent to "**/*",
> which I would have guessed to include the base dir, when it doesn't.
>
> I would have tried "*/**", which I would interpret as: all
> files directly in the base dir, and any sub-directories of
> those. This also parallels the fact that * in unix shells
> does not match ., the "base dir".
>
> All that to say that having to use "**/*" instead of "*/**"
> feels counter-intuitive to me ;-) --DD
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED] For
> additional commands, e-mail: [EMAIL PROTECTED]
>
>
--------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender does not
intend to waive confidentiality or privilege. Use of this email is prohibited
when received in error.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]