title: Some questions about System.IO.File.Copy in C# and the copy, xcopy, robocopy commands
body: <p>My C# Windows service application copies a lot of files over network via SMB, FTP or SSH all day and night. To do the file copies I simply use <code>System.IO.File.Copy</code>. Which command does the .NET Framework execute here? Is it <em>copy</em>? Maybe <em>xcopy</em>? Is this different on different Windows versions? I also read about <em>robocopy</em> but it seems there is no API. Is it worth the effort using P/Invoke with <em>xcopy</em> or <em>robocopy</em> instead of simple copy? At the moment I doubt that for my case.</p>
  
  <p>In a future release I have to copy all files in two remote directories instead of one. So what happens when I copy a file via </p>
  
  <blockquote>
    <p>File.Copy("c:\test.txt", "\\server1\dir1\test.txt")</p>
  </blockquote>
  
  <p>And then call </p>
  
  <blockquote>
    <p>File.Copy("\\server1\dir1\test.txt", "\\server1\dir2\test.txt")</p>
  </blockquote>
  
  <p>Will the files be copied twice from my server to the target server? As far as I understand my computer says to copy files from A to B so the files will be transfered from A to my machine to B, am I right?</p>