Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
File.Copy("E:\\Cockdata.xls", "\Attendance\\Cockdata.xls", true);

Attendance --> folder name. its folder is share folder
Posted
Updated 21-Sep-14 2:28am
v2
Comments
[no name] 21-Sep-14 8:34am    
"\Attendance\\Cockdata.xls" would not be the correct path. It should be "\\Attendance\\Cockdata.xls" but I doubt that would be correct for your system either.
[no name] 23-Sep-14 8:03am    
Try debugging and check whether you are getting any error or not!.

You will need to provide write access to network services user at the folder where you want to copy the file.
 
Share this answer
 
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.
 
Share this answer
 
Why did you make your question worse when you did "improve" it?
Originally, it was
C#
File.Copy("E:
\\Cockdata.xls", "10.1.10.15\\Attendance\\Cockdata.xls", true);

and that's almost correct. Almost: before the servername / ip, you need a double backslash.
C#
File.Copy(@"E:\Cockdata.xls", @"\\10.1.10.15\Attendance\Cockdata.xls", true);

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900