Well, I'm not sure if you can in the file write timestamps. If not, your unique alternative, is comparing the content of the files.
A fast way to do thatsimple approach is calculatingcomparing the files byte-to-byte, but if you're going to compare a file several times with others, you can calculate the hashcode of the file contentsfiles and compare it.
The following code snippet shows how toyou can do it.:
public static string CalcHashCode(string filename) { FileStream stream = new FileStream( filename, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); try { return CalcHashCode(stream); } finally { stream.Close(); } } public static string CalcHashCode(FileStream file) { MD5CryptoServiceProvider md5Provider = new MD5CryptoServiceProvider(); Byte[] hash = md5Provider.ComputeHash(file); return Convert.ToBase64String(hash); } EDIT: If you're going to compare a file with others more that one time, you can save the file hash and compare it. For a single comparison, the byte-to-byte comparison is better. You need also to recompute hash when the file changes, but if you're going to do massive comparisons (more than one time), I recommend using the hash approach.