Diff: only compare if file exists, not contents

You can't use diff for that. Why would your requirement be to use diff? Why do people always come to conclusions without having examined the possible solutions in detail?

You could use diff -qr but that wouldn't be wise from a performance point of view if the only goal is to compare the directory structure as outlined here

One of the answers to that question was

vimdiff <(cd dir1; find . | sort) <(cd dir2; find . | sort)

which

will give you a nice side-by-side display of the two directory hierarchies with any common sections folded.

Tags:

Diff