title: Detect if a file has been overwritten (Move and Replace) using C#
body: <p>I am currently writing some background processes for a website that are to be run nightly on a webserver.</p>
  
  <p>My main issue is that I need to detect whether an image file has changed in the last 24 hours. I thought that this would be easily achievable using the following code:</p>
  
  <pre><code>DateTime lastWrite = System.IO.File.GetLastWriteTimeUtc(HttpContext.Current.Server.MapPath(image.FileName));
  
  if (lastWrite &gt; DateTime.UtcNow.AddHours(-24) &amp;&amp; lastWrite &lt; DateTime.UtcNow)
  {
      var a = "This item has been modified";
  }
  else
  {
      var b = "This item has not been modified";
  }
  </code></pre>
  
  <p>however, it seems that this will only give me the DateTime when the file was last modified. This is great for if the image has been edited using something like paint but it does not tell me whether the image has been overwritten using a cut and paste on an existing image as the modified and create date remain the same as the original image that was in place.</p>
  
  <p>My question therefore is how do I detect whether a file (mainly images) have truly been modified (edited, copied over, removed then replaced) within a 24 hour period?</p>
  
  <p>Any help would be greatly appreciated.</p>