title: C# File.Copy Not enough quota
body: <p>I have a large application running on a bunch of machines. Once every 5 minutes it copies a file to do some manipulation on it.</p>
  
  <p><strong>The code works without a hitch almost 99.9% of the time but once every few hours I might get the error discussed here.</strong></p>
  
  <p>Here's the code:</p>
  
  <pre><code>try
   {
    File.Copy(fullPathName, readPathName, true);
   }
  catch (Exception exception)
   {
   ....
   }
  </code></pre>
  
  <p>This code runs in its own thread but should only be one of these threads running. Here's the error I get:</p>
  
  <blockquote>
    <p>Encountered an unexpected exception when trying to create the .tmp file. Not enough quota is available to process this command.</p>
    
    <p>at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
       at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
       at ....</p>
  </blockquote>