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 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo