title: How to rename a folder in c# which is currently opened by windows explorer
body: <p>When renaming a folder in C#, <code>System.IO.Directory.Move</code> throws <code>System.IO.IOException</code> (message "access denied") if that folder or any subfolder is currently opened by a (Windows 7) explorer window.
  Using the commandline <code>RENAME</code> fails, too.
  Using a second explorer windows succeeds.</p>
  
  <p>The error persists even after collapsing the parent folder (or its parents). In fact the particular explorer window needs to be closed.
  So the explorer seems to create some locks just to show the folder structure and does not release them even if the actual folder isnt displayed anymore (which is pure nonsens IMO).</p>
  
  <p>Is there a way to rename a folder (in program e.g. using C#), that is presently displayed (or was visible, see above) by an explorer window?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Found a way as described by my own answer to this question (see below) using <code>SHFileOperation()</code>. However, this solution is not very feasible (see also below).</p>