调用方法为:System.IO.File.Copy(filePath, fileEnd);
filePath =\\192.168.1.253\File\3b7c338f-e9a1-497a-be78-8f82b68b5f6c\3b7c338f-e9a1-497a-be78-8f82b68b5f6c.docx
fileEnd = \\192.168.1.253\WebDAV\但是报文件名、目录名或卷标语法不正确。共享已经打开,copy操作的时候报的错麻烦各位大哥解释下。谢谢

解决方案 »

  1.   

    @"\\192.168.1.253\File\3b7c338f-e9a1-497a-be78-8f82b68b5f6c\3b7c338f-e9a1-497a-be78-8f82b68b5f6c.docx"
      

  2.   

    试试:
    filePath = @"\\192.168.1.253\File\3b7c338f-e9a1-497a-be78-8f82b68b5f6c\3b7c338f-e9a1-497a-be78-8f82b68b5f6c.docx"; 
    fileEnd = @"\\192.168.1.253\WebDAV\";
      

  3.   

     filePath =\\192.168.1.253\File\3b7c338f-e9a1-497a-be78-8f82b68b5f6c\3b7c338f-e9a1-497a-be78-8f82b68b5f6c.docx 
    fileEnd = \\192.168.1.253\WebDAV\ 
            System.IO.File.File.Copy(filePath , fileEnd );
     
    试试
      

  4.   

    拷贝源是否已经打开或者被占用,对fileEnd文件夹是否有操作权限,或者copy的时候,是不是也得提供文件名+路径
      

  5.   

    public void copyFile()
        {
            filePathA = this.fei.PostedFile.FileName;//获取文件全部路径
            string fileName = this.fei.FileName;
            string path = System.IO.Path.GetDirectoryName(filePathA);
            filePathB = path + "\\1" + fileName;//重新设置文件名
            File.Copy(filePathA, filePathB);
        }这是我拷贝的代码!
      

  6.   

    必需用文件名全路径:
    A = @"C:\a.txt";
    B = @"D:\b.txt";
    File.Copy(A, B);