I have two folders A and B..inside that two folders lots of folders and files are there... I am comparing these two folders for non identical files with symmetric difference
It feels to me like you're looking for different things, really:
Files which are present in one directory but not the other (so use symmetric difference)
Files where they are present in both directories, but then:
I would treat these separately. You already know how to do the first part. To get the second part, you need the intersection of the two sets of filenames (just use the Intersect
extension method). From that you can list differences:
var differentLengths = from name in intersection
let file1 = new FileInfo(directory1, name)
let file2 = new FileInfo(directory2, name)
where file1.Length != file2.Length
select new { Name = name,
Length1 = file1.Length,
Length2 = file2.Length };
... you can then print those out. You can then do the same for last write times.
In other words, you don't actually need a comparer which compares all of the properties at a time.