[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to compare contents of two folders against third one?



Hello everyone.

I have a "/source-folder/" which contains very large tree of folders and files.
I've manually copied a set of folders and files from it to a "/destination-folder-one/" and
copied another set of folders and files to a "/destination-folder-two/".

Now, is there an effective way to compare combined contents of two folders "/destination-folder-one/" and
"/destination-folder-two/" against a "/source-folder/" to show if there is anything that was left out?

For now I've tried "diff" and "rsync" to accomplish this.
But diff apparently can't compare combined contents of two folders with another folder.
$ diff -r /destination-folder-one/ /destination-folder-two/ /source-folder/
diff: extra operand '/source-folder/'
diff: Try 'diff --help' for more information.


And rsync scans folders and files that are already exist inside both destination folders and "/source-folder/" and outputs nothing.
$ rsync -r --size-only --dry-run /destination-folder-one/ /destination-folder-two/ /source-folder/
$


I could go on a wild chase to "ls" contents of both destination folders, concatenate the results, sort them somehow,
do the same to a source folder and compare the resulting list files. Also create test cases to check if results are reliable.
But before I do that, is there a better way to accomplish the task?
Maybe some parameter for diff or rsync that I missed or another utility?

--
With kindest regards, Alexander.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀

Reply to: