使用 file.copy 方法复制现有文件。
添加要复制的文件的路径。
string mypath = @"d:\one.txt";
现在将上述文件复制到以下文件中 −
string mypath = @"d:\one.txt";
使用 file.copy 方法,同时指定源文件和目标文件。
file.copy(mypath,newpath);
示例using system;using system.io;public class program { public static void main() { string mypath = @"d:\one.txt"; // the file will get copied here string newpath = @"d:\two.txt"; // copying file file.copy(mypath,newpath); }}
以上就是c# 程序复制现有文件的详细内容。