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