I am trying to compare two files, one on a local computer and another on a web server, if the file on the web server is newer, it is downloaded / overwrites the local one. Although FileInfo will not take URI’s, can someone recommend a way around this please
private void checkver()
{
FileInfo sourceFile = new FileInfo("download.zip");
if (sourceFile.Exists)
{
FileInfo destFile = new FileInfo(@"http://www.google.com/download.zip");
if (destFile.Exists && destFile.LastWriteTime >= sourceFile.LastWriteTime)
{
MessageBox.Show("File already up to date");
}
else
{
MessageBox.Show("File is not up to date");
}
}
}
Try using
HttpWebRequestandHttpWebResponse: