Copy file to a different directory

前端 未结 7 1899
暖寄归人
暖寄归人 2021-02-05 01:23

I am working on a project where I want to copy some files in one directory to a second already existing directory.

I can\'t find a way to simply copy from one folder to

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-05 01:42

    MSDN File.Copy

    var fileName = "sourceFile.txt";
    var source = Path.Combine(Environment.CurrentDirectory, fileName);
    var destination = Path.Combine(destinationFolder, fileName);
    
    File.Copy(source, destination);
    

提交回复
热议问题