This content has been marked as final. Show 4 replies
String children = dir.list();You should use File children = dir.listFiles();
However, the files do not get deleted regardless ofI have 2 guesses
what I try and I cannot see why.
#1 If your directory contains subdirectories, you may be trying to delete those, and that is causing an IOException, knocking you out of your loop. Note that you cannot delete directories with File.delete
#2 Your app may not have file write permission.
There were no subdirectories but:
Has done the trick.
File children = dir.listFiles();
Many, many thanks.
Since you say you've tried a batch file that is also unable to delete files, I really doubt that Java is at fault here.
Looking at what tjacobs01 wrote, I'd say his #2 guess is probably correct.
edit: I am so horribly slow.
This is working now and the Duke Stars have gone to Tjacobs01.
Again, many thanks.