I want to copy a file from A to B in C#. How do I do that?
没有任何错误处理代码:
File.Copy(path, path2);
The File.Copy method:
Use the FileInfo class.
FileInfo fi = new FileInfo("a.txt");
fi.CopyTo("b.txt");
System.IO.File.Copy
This should work!
using System.IO;
...
var path = //your current filePath
var outputPath = //the directory where you want your (.txt) file
File.Copy(path,outputPath);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.