Copy file from one directory to another

后端 未结 5 426
执笔经年
执笔经年 2021-01-28 13:11

I am pretty new to C# and I am trying to get my program to copy a file from one location to another. The method I have is as below;

    private void CopyInstallF         


        
5条回答
  •  臣服心动
    2021-01-28 13:53

    Look at your sourceFile string and be aware of using the \, which could be interpreted as escape character.

    To prevent this start your string with @

    string sourceFile = @"F:\inetpub\ftproot\test.txt";
    

    or

    string sourceFile = "F:\\inetpub\\ftproot\\test.txt";
    

提交回复
热议问题