我正在将文件本地系统复制到另一个系统,但它不是copping .., [英] I am Copying file local system to another system but its not copping..,

查看:65
本文介绍了我正在将文件本地系统复制到另一个系统,但它不是copping ..,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

File.Copy(E:\\Cockdata.xls,\ Attendance \\Cockdata.xls,true);



出勤 - >文件夹名称。其文件夹是共享文件夹

File.Copy("E:\\Cockdata.xls", "\Attendance\\Cockdata.xls", true);

Attendance --> folder name. its folder is share folder

推荐答案

您需要在要复制文件的文件夹中为网络服务用户提供写访问权。
You will need to provide write access to network services user at the folder where you want to copy the file.


参见这里 [ ^ ]。在计算机/服务器/设备之间进行复制时,您必须模拟。您系统上的用户可能没有与您相同的权限。
See here[^]. You have to 'impersonate' when copying between computers/servers/devices. The users on your system might not have the same priviligers as yours.


为什么当您改进它时,您的问题会变得更糟?

最初,它是

Why did you make your question worse when you did "improve" it?
Originally, it was
File.Copy("E:
\\Cockdata.xls", "10.1.10.15\\Attendance\\Cockdata.xls", true);



,这几乎是正确的。几乎:在servername / ip之前,你需要一个双反斜杠。


and that's almost correct. Almost: before the servername / ip, you need a double backslash.

File.Copy(@"E:\Cockdata.xls", @"\\10.1.10.15\Attendance\Cockdata.xls", true);



注意:字符串前面的@字符有助于反斜视。


Note: the "@" character before a string helps with backslashitis.


这篇关于我正在将文件本地系统复制到另一个系统,但它不是copping ..,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆