I have 2 folders whose contents I want to compare. For instance I have folder 1 and folder 2. Folder 2 has a lot of new files + some files same as folder 1 but with some changes in contents of these files. Now, I want to compare folder 1 and folder 2 to get the list of folder 1 files which are changed or missing in folder 2.
When I run following command:
diff --brief -r folder1/ folder2/ > diff.txt
It also gives me the list of new files of folder 2.
I want to compare folder 1 and folder 2 to get the list of only those files of folder 1 which are missing or changed in folder 2.
How can I achieve this ?
Please don't recommend Meld
, I already tried it and it's of no help. I figured, command line would be faster.
UPDATE
find folder1 -type f -exec diff --brief --from-file=folder2 {} +
doesn't give me the full file path of the differed/missing files.
Best Answer
The
--from-file
option might be of use:So, in your case, it would be:
There's also the
--unidirectional-new-file
option:With it: