Home arrow static arrow Java Programming [Archive] - Deleting directories
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Deleting directories
This topic has 2 replies on 1 page.

Registered: 4/24/04
Deleting directories  
Jul 29, 2004 1:56 PM

I have this app (it is same all along my posts in this forum guys!!! :) ). When deletting a directory (MS platform) the operation not always succed. See this code:

File myFile = new File(myPathTo_a_folder);
if (myFile.exists() )
if (myFile.delete() )

Sometimes myFile.delete() returns a false value and i want to know why. How can i do that because no exception occurs, and what can be causing any trouble ?

Many thanks,


Registered: 8/15/02
Re: Deleting directories  
Jul 29, 2004 2:03 PM (reply 1 of 2)

Don't know about windoze, but on unix you can not delete a directory without first deleteing all it's contents

Registered: 6/26/00
Re: Deleting directories  
Jul 29, 2004 2:09 PM (reply 2 of 2)

JavaDoc on File.delete()

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

or during your run, that directory is locked, then you can't delete before something release the lock.

This topic has 2 replies on 1 page.