2

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.

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
Reza
  • 1,235
  • 3
  • 17
  • 31

1 Answers1

2

You could use tree to see the visual structure like:

tree folderA
tree folderB

or you could use diff to see what files are different in each subfolders

diff folderA folderB
lapisdecor
  • 1,627
  • 1
    You can also use diff on the folders directly. In Linux (and other Unixes), everything is a file, so from diffs viewpoint, a directory is a list of files. Therefore, it can print out the differences between those lists. – Henning Kockerbeck Jul 15 '16 at 11:47
  • @HenningKockerbeck thanks for your remark. I will edit my answer. – lapisdecor Jul 15 '16 at 11:52
  • I think I wasn't clear enough. You can think of B as A with its structures flattened (so (some of the) files in the (nested) subdirectories of A are moved into B). I'm not sure how useful diff can be for this purpose. – Reza Jul 16 '16 at 18:11