BrianMc1958
asked on
NEWBIE: Delete of directory seems to fail
Dear Experts,
I'm trying to delete a directory (on W2K box), like this:
File dummyFile = new File(dirName);
dummyFile.delete();
dummyFile = null;
It works at home, but not at my customer's site. How come?
The .delete is not set up to throw an exception. Doesn't that seem strange? Normally, all IO operations do that, right?
Thanks,
BrianMc1958
I'm trying to delete a directory (on W2K box), like this:
File dummyFile = new File(dirName);
dummyFile.delete();
dummyFile = null;
It works at home, but not at my customer's site. How come?
The .delete is not set up to throw an exception. Doesn't that seem strange? Normally, all IO operations do that, right?
Thanks,
BrianMc1958
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can of course tell if it hasn't worked by the fact that it would have returned false
ASKER
Oh. Didn't know it had to be empty. Also didn't know it returned boolean. Let me try...
If it's not
Runtime.getRuntime().exec( "cmd.exe /C rmdir /SQ " + dirName);
but be careful with that
Runtime.getRuntime().exec(
but be careful with that
ASKER
This would be my mistake-of-the-week. Would have sworn it was working fine. I'll post a follow up. Thanks one more time...
--BrianMc1958
--BrianMc1958
:-)
It was probably empty when you tried it ;-)