linux - The diff command for files with empty content -
if want difference between 2 directories, use command below:
diff -arun dir1/ dir2/ > dir.patch so dir.patch file should comprise differences want, right?
but if dir2/ contains file empty content, , file not existent in dir1/, example,
dir1/ dir2/empty_content_file.txt ------ empty content. then diff command not generate patch empty_content_file.txt, needed file.
is there expertise or alternative way this?
thank in advance.
it's because you're using -n option, added explicitly treat absent file empty. man diff says :
-n, --new-file treat absent file empty