You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by KC Baltz <KB...@responsenetworks.com> on 2000/11/14 14:47:47 UTC

Stupid question

I have been banging my head against my build.xml file and I still can't
figure out this simple task.  I just want to delete all the files and
subdirectories in a given directory.  So if I have a directory /tmp, I want
to delete any files in /tmp (got that working) and any subdirectories (this
isn't working).  The docs for <delete> aren't clear on how to delete a
directory.  BTW,  I discovered you can delete directories with <delete
dir="/tmp/foo" />, but I don't want to have to enumerate all the dirs under
/tmp and I don't want to rmdir /tmp either.

Can someone provide the code to do this?

K.C.

Re: Stupid question

Posted by Stefan Bodewig <bo...@bost.de>.
KC Baltz <KB...@responsenetworks.com> wrote:

> I just want to delete all the files and subdirectories in a given
> directory.  So if I have a directory /tmp, I want to delete any
> files in /tmp (got that working) and any subdirectories (this isn't
> working).

but not /tmp itself. 

Sorry, but I think this is not possible. Closest you can get is

<delete dir="/tmp" />
<mkdir dir="/tmp" />

but this behavior is the same you'd see with deltree as well, isn't
it?

ISTR that handling of empty directories was on Glenn's TODO list.

Stefan