ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Duncan Davidson <>
Subject Re: Why can't <delete> just simply delete the directory?
Date Sun, 10 Dec 2000 19:51:37 GMT
On 12/7/00 2:50 PM, "Jay Glanville" <> wrote:

> The task performs beautifully, but not efficiently.  Before it deletes the
> directory, it deletes all the files within it.  However, when my
> ${build.loc} contains over 4000 files, this deleting of files can take a
> while. (true, only a little over 60 seconds)  Why can't it simply delete the
> directory itself?

When I was first writing ant -- I tried to just file.delete(); and was
disappointed that it didn't work. However, the Javadoc for the method

"Deletes the file or directory denoted by this abstract pathname. If this
pathname denotes a directory, then the directory must be empty in order to
be deleted."

There's no equivalent to 'rm -rf' in the class -- so chasing
the tree down and nuking all files, then all directories, back to the parent
is the only way to do it.


James Duncan Davidson                              
                                                                  !try; do()

View raw message