The reason why you get that output when running diff -qr a b
is because the subdir1
is only in a
. Because of that, everything under a
must be different than in b
so it apparently doesn't go through and list all the files. I haven't found a way for it to list all the files regardless. I put together another command that will hopefully help!
My file structure:
Matt@MattPC ~/perl/testing/10
$ find .
.
./a
./a/file1
./a/subdir1
./a/subdir1/file1
./a/subdir1/file2
./b
./b/file1
The diff command you ran (same output):
Matt@MattPC ~/perl/testing/10
$ diff -q -r a b
Only in a: subdir1
Here's a command I wrote that will hopefully get you what you need. Basically, it calls find a
and find b
and pipes the output to diff to compare them. However, we have to pipe that to sed 's/^[^/]\+//'
to remove the name of the first directory, in this case a
and b
.
Matt@MattPC ~/perl/testing/10
$ diff <(find a | sed 's/^[^/]\+//') <(find b | sed 's/^[^/]\+//')
3,5d2
< /subdir1
< /subdir1/file1
< /subdir1/file2
Hope this helps! Let me know if the command needs tweeking.