title: File.Copy from local to shared folder in server
body: <p>I'm having problems when copying a .txt from a local server ("D:\AuditFiles") to a shared folder in another server ("\\PrintServer\SharedFolder"). It throws the exception:</p>
  
  <blockquote>
    <p>"The filename, directory name, or volume label syntax is incorrect."</p>
  </blockquote>
  
  <p>I thought it could be something with the path format, so I tried by adding to the server path an @: </p>
  
  <p><code>@Configuration.Manager["Path"]</code> | <code>@"\\ServerPath\SharedFolder"</code></p>
  
  <p>I've also tried with this format: \\ServerPath\SharedFolder... None of them worked.</p>
  
  <p>By the way its not an access problem, cause i've tried to do the same thing running a command prompt from within c#:</p>
  
  <pre><code>System.Diagnostics.Process.Start("cmd.exe", "/C COPY PATH1, PATH2"); //This worked and copied the file.
  </code></pre>
  
  <p>I'd be greatful if someone could give me a clue of what could be the problem here. At least an advice of what to do.</p>
  
  <p>Thanks in advance and sorry me bad english!</p>
  
  <p>Edit: </p>
  
  <p>This is the part of the code that should work:</p>
  
  <pre><code>string pathPrevDay = "D:\AuditFiles\enc_" + svr.Name + "_counts" + day.AddDays(-1).ToString("dd-MM-yy") + ".txt";
  
  if(File.Exists(pathPrevDay))
  {
      File.Copy(pathPrevDay, @ConfigurationManager.AppSettings["MAIL_SERVER_PATH"]);
  }
  </code></pre>