I need to delete a directory containing some files. I am using the following code:
public static void delete(File f) {
if (f.isDirectory()) {
for (File c : f.listFiles()) {
delete(c);
}
}
f.setWritable(true);
f.delete();
}
For some reason, some files inside the directory, and hence the directory does not get deleted. What could be the possible reasons for this behavior, and how can I solve this problem?