2

I wanted to ask if there is a command in Linux that can check recursively for two folder's contents and generate an output of the differences.

What I need is a command that only compares the file name and structure of it and not the contents of each file. The reason for this is that I just backed up 2TB worth of data on different occasions and guarantee that all the data retained its integrity and have the same contents, but I want to check if I copied all the back-ups to see if I have missed one (It is hard to manually check 5000 folders).

Here is a little sample

/dir1 --> turtle.pdf banana_folder chicken.leg
/dir2 --> turtle.pdf banana_folder

I have used the diff command with the -qr and -r arguments but it takes too long just to traverse the files, which I feel it does not only check the structure and file name (Tested on a folder with 10 4GB files)

My limitations are that I can only use a command line since I cannot transfer the drive nor enter the GUI of the linux environment

Fukkatsu
  • 149
  • 1
  • 12

1 Answers1

3

you can just diff the lists obtained with find:

find dir1 | sort > list1.txt
find dir2 | sort > list2.txt
diff list1.txt list2.txt
Pavel
  • 7,436
  • 2
  • 29
  • 42
  • 1
    Note that this only works if you `cd` to `dir1` and `dir2` before doing the find command (which doesn't need an argument then). So I do: `cd dir1` `find | sort > list1.txt` etc. – erik Feb 08 '18 at 16:27