title: java.nio.file.AccessDeniedException while using Files.move()
body: <p>I'm doing a <code>java.nio.file.Files.move(path, path.resolveSibling("newfilename"))</code> to rename a directory on windows 7.</p>
  
  <p>But I'm getting the following exception:</p>
  
  <pre><code>java.nio.file.AccessDeniedException: oldfilename -&gt; newfilename
      at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
      at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
      at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:387)
      at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:287)
      at java.nio.file.Files.move(Files.java:1345)
  </code></pre>
  
  <p>What is causing this? I'm using Java 7.<br>
  The target path does not exist before the invocation of <code>Files.move()</code>.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#move%28java.nio.file.Path,%20java.nio.file.Path,%20java.nio.file.CopyOption...%29" rel="noreferrer">From javadoc</a>:</p>
  
  <pre><code>When moving a directory requires that its entries be moved then this method fails
  (by throwing an IOException).
  </code></pre>
  
  <p>My <strong>directory is non-empty</strong> and contains regular files, so maybe that is the reason that it cannot be used here? I'm having problems understanding the "requires that its entries be moved" wording. When is this the case?</p>