You can use the File.Copy method (oldFilePath, newFilePath) or in another way, read the file using StreamReader into a string, and then use StreamWriter to write the file to the destination.
Your code might look like this:
StreamReader reader = new StreamReader("C:\foo.txt"); string fileContent = reader.ReadToEnd(); StreamWriter writer = new StreamWriter("D:\bar.txt"); writer.Write(fileContent);
You can add exception handling code ...
Shekhar Oct 07 '10 at 12:12 2010-10-07 12:12
source share