Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello..
I'm working on windows app. I wanna programatically copy the file which is available in project to specified location on drive.
Can u help me?
Posted
Comments
Sandeep Mewara 10-Feb-11 2:13am    
Sure, did you try? Tell us the issue you faced and we will surely help.
krishna kishore58 10-Feb-11 2:14am    
Im not striking like how to do it... I tried alot and still I'm trying. I have a file in folder which is available in project so i wanna copy that file to local specified path so im unable to locate that file path. Can u help me?
Rajesh Anuhya 10-Feb-11 2:54am    
No Effort

hi,
try this code:
System.IO.File.Copy(string sourcefilename,string destfilename);
sourcefilename:path and full name of file to copy.
destfilename:path and full new name as destination.
 
Share this answer
 
This is for Web Application:

HttpPostedFile hpf;
hpf.SaveAs(Server.MapPath("PathDirectoryYouWantToSaveYourFileIn") + "\\" + Path.GetFileName("FileName"));
 
Share this answer
 
Try:
C#
File.Copy(pathSource, pathDestination, true);

Details: MSDN[^]
 
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