I need to copy a file to another path, leaving the original where it is.
I also want to be able to rename the file.
Will FileInfo's CopyTo method work?
Have a look at File.Copy()
Using File.Copy you can specify the new file name as part of the destination string.
So something like
File.Copy(@"c:est.txt", @"c:estfoo.txt");
See also How to: Copy, Delete, and Move Files and Folders (C# Programming Guide)
1.4m articles
1.4m replys
5 comments
57.0k users