Return-Path: Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 21222 invoked from network); 10 Dec 2000 19:51:39 -0000 Received: from glatton.cnchost.com (207.155.248.47) by locus.apache.org with SMTP; 10 Dec 2000 19:51:39 -0000 Received: from [192.168.254.103] (w073.z208176176.sjc-ca.dsl.cnc.net [208.176.176.73]) by glatton.cnchost.com id OAA16288; Sun, 10 Dec 2000 14:51:39 -0500 (EST) [ConcentricHost SMTP Relay 1.10] Errors-To: User-Agent: Microsoft-Entourage/9.0.2509 Date: Sun, 10 Dec 2000 11:51:37 -0800 Subject: Re: Why can't just simply delete the directory? From: James Duncan Davidson To: Message-ID: In-Reply-To: <6DDA62170439D31185750000F80826AC04A3AD17@zmerd004.ca.nortel.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N 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 specifies: "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 java.io.File class -- so chasing the tree down and nuking all files, then all directories, back to the parent is the only way to do it. .duncan -- James Duncan Davidson duncan@x180.net !try; do()