C#中文件移动演示代码, C#中可以通过FileInfo类的MoveTo来移动文件
using System; using System.IO; namespace Client.Chapter_11___File_and_Streams { public class MovingAFiles { static void Main(string[] args) { FileInfo MyFile = new FileInfo(@"c:\Projects\Testing.txt"); MyFile.Create(); MyFile.MoveTo(@"c:\Projects\MyFolder\Moved Testing.txt"); MyFile.MoveTo(@"C:|projects\MyFolder"); } } }