ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Surette <psure...@espial.com>
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' 
                defaultexcludes='no' 
                includes='**/*' />
        </delete>
    </target>

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 [mailto:myusenet@yahoo.com]
Sent: Tuesday, January 29, 2002 12:21 AM
To: ant-user@jakarta.apache.org
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}" />
</delete>

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
documentation 

<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
way.

Thanks,
Barry

__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message