The rsync
utility first popped into my mind when I saw your question. Doing something like below could quickly show what files are in directory a
but not in b
:
$ rsync -rcnv a/* b/
-r will recurse into the directories
-c will compare based on file checksum
-n will run it as a "dry run" and make no changes, but just print out the files
that would be updated
-v will print the output to stdout verbosely
This is a good option because you can compare the contents of the files as well to make sure they match. rsync
‘s delta algorithm is optimized for this type of use case. Then if you want to make b
match the contents of a
, you can just remove the -n
option to perform the actual sync.
Some related questions: