I am trying to delete the content of the directory with few files, and I am not able to delete it. When I tried the methods .delete()
it returns a false
, but .canWrite()
, .canRead()
method returns true
for the code.
My file path in the system is:
E:\PROJECT01022012\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\realmap\PHOTO\VFIN5CT5651842012\Inspirational-GravityHighRes.jpg
I tried this and this but no luck.
public static boolean removeDirectory(File directory){
if (directory.isDirectory())
{
File[] fls=directory.listFiles();
for (int i = 0; i < fls.length; i++) {
fls[i].delete();
}
}
}