title: skipping files while deleting that are currently in use
body: <p>i try to make a temp cleaner and the program it self works but how can i write the programm that it skips the files that are currently in use?</p>
  <p>here is the script i used</p>
  <pre><code>System.IO.DirectoryInfo di = new DirectoryInfo(path);
  
      foreach (FileInfo file in di.GetFiles())
      {
          file.Delete(); 
      }
      foreach (DirectoryInfo dir in di.GetDirectories())
      {
          dir.Delete(true); 
      }
  </code></pre>