5/21/2023 0 Comments Compare folders for differencesIf a file exits, compare the 2 files, create an entry and add it to a list that tracks comparisons (discussion about the compare operation follows).For the current file see if a corresponding file exists in the other side.If it's a file, call the method to process it. Get a list of all files and folders in the root directory I will try to simplify the logic I use here (assuming the "Recusive" checkbox is checked): And an important point to note in this case is that everything that the recursive comparer does starts with the file name and it's case sensitive. I have also made sure that code is not repeated by sharing code between the left and right comparisons, for example how a file is processed. The only thing right comparison has to do is to deal with files that are available only in the right. The first pass comparison is in turn split in to multiple simple parts. If you think of it, left comparison would do bulk of the comparison efforts. I would say any complex problem could be simplified in to multiple simple problems. They are (1) Comparison with respect to the left folder and (2) Comparison with respect to the right folder. It implements the ITwoPassComparer interface, which, as the name suggests handles the comparison in 2 phases. I also wanted it to be extensible and so the core functionality is implemented using interfaces, so that it is truly extensible.Īt the heart of it, Directory Comparer has the RecursiveComparer. So, I just came up with this recurive comparison tool. This is what I define as "simple" - Choose folder 1, choose folder 2, click on button, I should be done. But I just wanted something that is simple and straight-forward. Yes, out there are a few directory comparers. Directory comparer is extensible so you always have the option of creating your own comparers or own UI for representing the results of the default comparers provided. I have also added my future thoughts about this project in the points of interest section. When I started with this project, it had limited features, but as time porgressed, I incorporated a lot more features. It tries to introduce a few concepts apart from providing some tips. I have discussed this application in a way which I feel would be pretty helpful. Download Directory_ComparerBinary.zip - 99.98 KBĭirectory comparer, as the name implies, is a tool to compare folders.Download Director圜omparerSource.zip - 193.36 KB.
0 Comments
Leave a Reply. |