title: The device is not ready when copying a file from one server to another
body: <p>What am I doing wrong here?</p>
  
  <p><img src="https://i.imgur.com/XasC9.png"></p>
  
  <p>I have checked the variables and they are what they are supposed to be so no issues there.</p>
  
  <p>Am I missing something here? Why am I getting a "device is not ready" exception?</p>
  
  <p>Code -</p>
  
  <pre><code>if (ddlPublisherServer.Text != ddlSubscriberServer.Text)
  {
     try
     {
         if (File.Exists("\\\\" + ddlSubscriberServer.Text + "\\SQLServerBackups\\" + txtSubscriberDatabaseName.Text + ".bak"))
         {
             File.Delete("\\\\" + ddlSubscriberServer.Text + "\\SQLServerBackups\\" + txtSubscriberDatabaseName.Text + ".bak");
         }
  
         File.Copy(@"D:\SQLServerBackups\" + txtSubscriberDatabaseName.Text, "\\\\" + ddlSubscriberServer.Text + "\\SQLServerBackups\\" + txtSubscriberDatabaseName.Text + ".bak");
         }
         catch (Exception ex)
         {
              ClientScript.RegisterStartupScript(GetType(), "Error!", "alert('" + ex.Message + "');", true);
              Logger.LogError(ex.Source, ex.TargetSite.ToString(), ex.Message);
              return;
         }
     }
  </code></pre>