Reputation: 223
If I want to get the difference between the 2 directories, I use the command below:
diff -aruN dir1/ dir2/ > dir.patch
so the dir.patch file should comprise all differences I want, right?
But if dir2/
contains a file with empty content, and that file is not existent in dir1/
, for example,
dir1/
dir2/empty_content_file.txt ------ with empty content.
Then the diff command will not generate any patch for empty_content_file.txt, but it is a needed file.
Is there any expertise or alternative way to do this?
Thank you in advance.
Upvotes: 0
Views: 2727
Reputation: 223
The screenshot below shows the operation of "diff -aru" command for inexistent files in the first directory, a message "Only in xxx" will show.
Upvotes: 0
Reputation: 142625
It's because you're using -N
option, which is added to explicitly treat absent file as empty. man diff
says :
-N, --new-file
treat absent file as empty
Upvotes: 1