Folder B is obtained from (a copy of) folder A by an undelete application such as extundelete and therefore its structure is messed up. How can I determine if every file in B and its subfolders exists somewhere in A as well?
Here I'm assuming files have preserved names but the same question can be asked for when file comparison is done using file contents only.
You could use tree to see the visual structure like:
or you could use diff to see what files are different in each subfolders