tags:

views:

1424

answers:

4

I want to copy a file from A to B in C#. How do I do that?

A: 

System.IO.File.Copy

Jedi Master Spooky
A: 

Use the FileInfo class.

FileInfo fi = new FileInfo("a.txt");
fi.CopyTo("b.txt");
Eric Z Beard
+8  A: 

The File.Copy method:

MSDN Link

Shaun Austin
+6  A: 

Without any error handling code:

File.Copy(path, path2);
Corey