evgeni / cfgdiff

diff(1) all your configs
MIT License
141 stars 13 forks source link

treat absent files as empty #2

Closed evgeni closed 10 years ago

evgeni commented 10 years ago

From man diff:

   -N, --new-file
          treat absent files as empty

Example:

% mkdir /tmp/foo/a /tmp/foo/b
% echo bar > /tmp/foo/a/foo
% diff -Nrwu /tmp/foo/a /tmp/foo/b
diff -Nrwu /tmp/foo/a /tmp/foo/b
--- /tmp/foo/a  2014-02-05 08:25:12.861979159 +0100
+++ /tmp/foo/b  1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-r bar
% diff -rwu /tmp/foo/a /tmp/foo/b
Only in /tmp/foo/a: foo

Works also for files that are only in b, obviously.