title: Force delete windows directory from python
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4102638/directoryinfo-deletetrue-doesnt-delete-when-folder-structure-is-open-in-window">DirectoryInfo.Delete(True) Doesn&#39;t Delete When Folder Structure is Open in Windows Explorer</a>  </p>
  </blockquote>
  
  
  
  <p>Folks, I am writing a python testing harness and part of the project involves uninstalling an application and then reinstalling it every night.  Part of the uninstall task involves deleting the data directory.  During the day testers/developer will be logging into the computer and occasionally a command prompt and/or log file is left open.  This causes my script to fail as windows will not let me delete a file if another process has a handle to it.</p>
  
  <p>I would like to know if it is possible to get the pid of the process that is holding onto the file so I can kill the process with WMI or something like that?  I would like to do this without logging people out.</p>
  
  <p>If it is impossible then is there a way, from python, to force logout of all users to to get a system where my script can keep working without waiting for me to show up and kill process/log out users?</p>
  
  <p>Any suggestions at all are greatly welcome.  I am not an experienced windows programmer.</p>