开发者

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

  1. if File does not exist on local machine

  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜