title: Cannot delete directory with image
body: <p>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 <code>.delete()</code> it returns a <code>false</code>, but <code>.canWrite()</code>, <code>.canRead()</code> method returns <code>true</code> for the code. </p>
  
  <p>My file path in the system is:</p>
  
  <p>E:\PROJECT01022012\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\realmap\PHOTO\VFIN5CT5651842012\Inspirational-GravityHighRes.jpg</p>
  
  <p>I tried <a href="http://www.java2s.com/Tutorial/Java/0180__File/Removeadirectoryandallofitscontents.htm" rel="nofollow noreferrer">this</a>  and <a href="https://stackoverflow.com/questions/991489/i-cant-delete-a-file-in-java">this</a> but no luck.</p>
  
  <pre><code>public static boolean removeDirectory(File directory){
  
   if (directory.isDirectory())
      {
       File[] fls=directory.listFiles();
  
       for (int i = 0; i &lt; fls.length; i++) {
            fls[i].delete();
  
       }
       } 
  
  }
  </code></pre>