text: FileInfo.CopyTo Method (String, Boolean)
  Copies an existing file to a new file, allowing the overwriting of an existing file.
  Assembly: mscorlib (in mscorlib.dll)
  Parameters
  - destFileName
  - Type: System.String
  The name of the new file to copy to.
  - overwrite
  - Type: System.Boolean
  true to allow an existing file to be overwritten; otherwise, false.
  Return ValueType: System.IO.FileInfo
  A new file, or an overwrite of an existing file if overwrite is true. If the file exists and overwrite is false, an IOException is, specifying whether to overwrite a file that already exists.
  using System; using System.IO; public class CopyToTest { public static void Main() { // Create a reference to a file, which might or might not exist. // If it does not exist, it is not yet created.. StreamReader sr = new StreamReader( fi.OpenRead() ); Console.WriteLine("This is the information in the first file:"); while (sr.Peek() != -1) Console.WriteLine( sr.ReadLine() ); // Copy this file to another file. The true parameter specifies // that the file will be overwritten if it already exists. FileInfo newfi = fi.CopyTo("newTemp.txt", true); // Get the information out of the new file and display it. sr = new StreamReader( newfi.OpenRead() ); Console.WriteLine("{0}This is the information in the second file:", Environment.NewLine); while (sr.Peek() != -1) Console.WriteLine( sr.ReadLine() ); } } //This code produces output similar to the following; //results may vary based on the computer/file structure/etc.: // //This is the information in the first file: //Add as many lines as you like... //Add another line to the output... //Add as many lines as you like... //Add another line to the output... //This is the information in the second file: //Add as many lines as you like... //Add another line to the output... //Add as many lines as you like... //Add another line to the output...
  - FileIOPermission
  for reading and writing files..