Simpler:
diff -urN dir1/ dir2/ |diffstat
using GNU diff's -N
option, e.g., when comparing directories:
If only one file exists, diff normally does not show its contents; it merely reports that one file exists but the other does not. You can make diff act as though the missing file is empty, so that it outputs the entire contents of the file that actually exists. (It is output as either an insertion or a deletion, depending on whether the missing file is in the first or the second position.) To do this, use the --new-file
(-N
) option.