Compare local file to downloaded file
I am using below code to download file from below URI.
File needs to be only downloaded only if it does not exist in Local Machine.
Below code should run only if Application is trying to find the file. It finds on local machine but there is also a updaed version on Server. HOw i can check if file on local machine and server are same.
Or File present on server has been updated. So that below code should download file in two conditions
if File does not exist on local machine
if file on Server has been updated , in this case file also exist on local machine but we need to download newer v开发者_如何学Pythonerion of file and replace order one.
System.Net.WebClient webClient = new System.Net.WebClient();
try
{
webClient.DownloadFile("https://message.com/hello.csv", fieldsFilePath);
}
1 is just file exist
2 You would have to check the header and see if there is size information in there, try the WebRequest class. Then compare that to the size of the local file.
精彩评论