The chance you would generate false positives from comparing md5sums is in the millions and the contents of the files would have to be drastically different to have that chance. md5sum is designed to generate a hash based on the file contents even a slight byte difference would generate a different hash. Is there any better way by which I can inherit FileInfo class in my FileConfig class and then use length method of each file to do the comparison? or what I have is fine here? My goal at the end is to compare files (and also use file content for some other purpose) so I was using MD5Hash string of each file in FileConfig class and figuring it out whether they are different or not like below: !(oldFile.First().MD5Hash) Var md5Hash = procUtility.GetMD5Hash(cfgPath) Var pathPieces = cfgPath.Split(System.IO.Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries) Var date = File.GetLastWriteTimeUtc(cfgPath) IList files = procUtility.GetListOfFiles(path) private IEnumerable LoadFiles(string path) I have a MD5Hash string for each file so that I can compare it later on with some other files to figure out whether particular file is different or not.īelow is my code where I get list of all the files from the disk and then I make a list of FileConfig object from it. I created a FileConfig class as shown below which has all the metadata for each file. I have a list of files on the disk which I need to get and load it in memory.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |