One way: Make copies of both projects, rename files and folders in one so that they match the files and folders in the other, and then use your favorite folder comparison tool to compare them.
This will not help you if there is no true copy and paste relationship between the two projects.
The best way is to use refactoring. After creating unit tests for both projects and achieving an adequate level of code coverage, navigate the class by class and method using the refactoring method to try to make the pairs of methods the same. Then you can define the methods that you need to pull into base classes or move to other classes.
In the end, you can find pairs of classes that are identical. Move these classes to a shared library, and then rename all uses of one of the classes to use the other. Then delete the one that is no longer in use.
Repeat until there is no more duplication.
source share