ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Surette <>
Subject RE: How do I empty a directory in 1.4.1
Date Tue, 29 Jan 2002 14:20:48 GMT
This will delete everything in a directory but leave the
directory itself alone. It has the advantage that it won't
fail under win32 if you have a dos prompt open in the
'test' directory:

    <target name='cleanWithFilesetAndIncludes' depends='clone'>
        <delete includeEmptyDirs='true'>
            <fileset dir='test' 
                includes='**/*' />

The defaultexcludes='no' is important in case you edited
some files in the test directory an your editor left
some backup file cruft.

-----Original Message-----
From: Barry Ku []
Sent: Tuesday, January 29, 2002 12:21 AM
Subject: How do I empty a directory in 1.4.1

How do I delete everything including subdirectories in
a directory, but keep the directory in 1.4.1?

The following works in 1.3, however, it removes the
directory itself in 1.4.1.

<delete includeEmptyDirs="true">
<fileset dir="${dist}" />

I thought it's a bug at first, then I found the
documentation in 1.4.1 has changed for the last
example in the Delete task. The 2nd example in the

<delete dir="$(dist)">

does the samething as the last one.  Why do we need
both if they are doeing exactly the same thing?

In order to may my old script work in 1.4.1, I have to
add the following right after my old script,

<mkdir dir="${dist}"/>

This works, but I wonder if there's a more elegant


Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!

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

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

View raw message