you have forgotten to give the file name in new path:
File.Copy(sitemap_path,server_path + "\\newFileName.xml", true);
Question
How do I copy across a file to another location in c# and overwrite the file if it exists.
Here is what I have so far:
string sitemap_path = "T:\\somefolder\\somefolder\\somefolder\\Sitemap.xml";
string server_path ="X:\\somefolder\\somefolder\\somefolder";
File.Copy(sitemap_path,server_path,true);
Console.WriteLine();
Console.ReadLine();
Solution
you have forgotten to give the file name in new path:
File.Copy(sitemap_path,server_path + "\\newFileName.xml", true);
OTHER TIPS
You also have to include the file name in the server path string not just the destination directory See:http://msdn.microsoft.com/en-us/library/9706cfs5(v=vs.110).aspx