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
BrianMc1958Asked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
Is it empty (won't work otherwise)?
0
 
CEHJCommented:
You can of course tell if it hasn't worked by the fact that it would have returned false
0
 
BrianMc1958Author Commented:
Oh.  Didn't know it had to be empty.  Also didn't know it returned boolean.  Let me try...
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
CEHJCommented:
If it's not

Runtime.getRuntime().exec("cmd.exe /C rmdir /SQ " + dirName);

but be careful with that
0
 
BrianMc1958Author Commented:
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
0
 
CEHJCommented:
:-)
0
 
CEHJCommented:
It was probably empty when you tried it ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.