Click here to Skip to main content
15,917,328 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,

I am using Downloadfile() method of System.Net.Webclient class to download file present in server to local directory. I want to know whether it will overwrite the existing file or not.
My Observation: Time stamp in the new file is shown as old file.

Is there any method to download file with overwrite option other than My.Computer.Network.Downloadfile()?

Thanks in advance,
Vijay
Posted
Updated 29-Aug-11 18:14pm
v3
Comments
Sergey Alexandrovich Kryukov 27-Aug-11 21:20pm    
What is "My"? Which one of the two download methods did you use? And -- finally -- why would not you simply try it to get the answer? I would say it must overwrite; don't want to try -- you can do it.
--SA
Vijay hit 27-Aug-11 21:43pm    
We have not included My.Computer.Net namespace in our solution. So, I have to find other alternatives. That is the reason I am using System.Net.Webclient.Downloadfile() method.

I think it will overwrite only when there is a change in the file present at server. Otherwise it wont overwrite. Am I correct?

1 solution

As it says in Community Content, it will overwrite the file if it exists.
http://msdn.microsoft.com/en-us/library/ez801hhe(v=VS.80).aspx[^]
Talking about time stamp, it will have same Created stamp. You should check Modified stamp.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 30-Aug-11 0:38am    
Exactly as I expected. Thank you for confirmation. My 5.
--SA
Vijay hit 30-Aug-11 2:53am    
I checked the Modified stamp and found out that it is overwriting.
Thanks a lot for the answers and comments.
Prerak Patel 30-Aug-11 3:00am    
You should mark it as answer if your query is solved.

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