C# 程序制作现有文件的副本
使用 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);
}
}
广告
数据结构
联网
关系数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
JavaScript
PHP