You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Robert Mark Bram <re...@optusnet.com.au> on 2004/10/12 09:46:31 UTC

Delete files and subdirectories, but NOT the base dir

Hi All!

I want to recursively delete everything inside build, but leaving build 
alone. This is what I have so far.

<delete includeEmptyDirs="true" >
<fileset dir="${build}" defaultexcludes="no" />
</delete>

Is there a way to do this other than deleting and re-creating the whole 
thing?
<delete dir="${build}" />
<mkdir dir="${build}" />

Advice would be most welcome!

Rob
:)

-- 
Robert Mark Bram
http://phd.netcomp.monash.edu.au/RobertMarkBram/
B.Comp.(Systems Development/Business Systems)
B.Net.Comp.(Hons)
Doctor of Philosophy Student

School of Network Computing
Faculty of Information Technology
Monash University
Peninsula Campus
McMahons Rd
Frankston, VIC 3199
AUSTRALIA

Phone:  61 3 9904 4394
Facsimile:  61 3 9904 4124
Email: robert.bram@infotech.monash.edu.au

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


Re: Delete files and subdirectories, but NOT the base dir

Posted by Peter Reilly <pe...@apache.org>.
Try:
    <delete includeEmptyDirs="yes">
      <fileset dir="dir" includes="**/*"/>
    </delete>
Peter

Robert Mark Bram wrote:

> Hi All!
>
> I want to recursively delete everything inside build, but leaving 
> build alone. This is what I have so far.
>
> <delete includeEmptyDirs="true" >
> <fileset dir="${build}" defaultexcludes="no" />
> </delete>
>
> Is there a way to do this other than deleting and re-creating the 
> whole thing?
> <delete dir="${build}" />
> <mkdir dir="${build}" />
>
> Advice would be most welcome!
>
> Rob
> :)
>


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


Re: Delete files and subdirectories, but NOT the base dir

Posted by Ivan Ivanov <ra...@yahoo.com>.
Hello, 

> Hi All!
> 
> I want to recursively delete everything inside
> build, but leaving build 
> alone. This is what I have so far.
> 
> <delete includeEmptyDirs="true" >
> <fileset dir="${build}" defaultexcludes="no" />
> </delete>
> 
> Is there a way to do this other than deleting and
> re-creating the whole 
> thing?

Yes, there is. I copied it directly from ant manual on
delete task:
  <delete includeemptydirs="true">
    <fileset dir="build" includes="**/*"/>
  </delete>

deletes all files and subdirectories of build, without
build itself.

HTH Ivan


		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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