Solved

NEWBIE: Delete of directory seems to fail

Posted on 2006-11-01
7
219 Views
Last Modified: 2010-03-31
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
0
Comment
Question by:BrianMc1958
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 17850746
Is it empty (won't work otherwise)?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17850761
You can of course tell if it hasn't worked by the fact that it would have returned false
0
 

Author Comment

by:BrianMc1958
ID: 17850785
Oh.  Didn't know it had to be empty.  Also didn't know it returned boolean.  Let me try...
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 86

Expert Comment

by:CEHJ
ID: 17850839
If it's not

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

but be careful with that
0
 

Author Comment

by:BrianMc1958
ID: 17850888
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 17850931
:-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17850937
It was probably empty when you tried it ;-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Desingning Refactoring existing code 2 32
How to convert from xls to xlsx using java 7 95
Java syntax, or is it Selenium 6 43
jmeter usage 4 38
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question