diff won't work recursively

1

I'm trying to recursively diff two directories using the command line diff util. I have two folders, diff1 and diff2, with contents like this:

enter image description here

diff2 is empty. But when I do diff -r diff1 diff2 I only get

$ diff -r diff1 diff2
Only in diff1: folder
Only in diff1: test.html

This is vexing. What do I need to do to get diff working recursively? I've tried --recursive, but that doesn't help. I'm on El Capitan, and a diff -v gets me diff (GNU diffutils) 2.8.1.

user73784

Posted 2017-08-25T08:44:05.963

Reputation: 121

what would you expect output to be when one folder is empty? Nothing to diff really. It tells you whats in diff1. That is the difference. Have you tried putting a file in diff2? Or the file test.html with edited differences. – jmh – 2017-08-25T17:38:29.110

Looks like it is working... – jmh – 2017-08-26T14:53:25.837

@john, I'd expect the diff to recurse into the directory called folder - I mean what about another-folder, hello-txt and test2.html? When I read "recursively" I assume that the process won't stop at the first level. – user73784 – 2017-08-28T15:23:39.180

oh sorry, i missed that. Have you tried a capital R? as in -R – jmh – 2017-08-28T15:25:18.343

1no that won't work as there is no -R option. Sorry again. -r should work, I'm as baffled as you are... Unless the empty directory is confusing it somehow. – jmh – 2017-08-28T15:32:23.917

No answers