i need to write a script that compares two directories AAAA & BBBB. The differences in directory AAAA should be copied to BBBB. Just like incremental copy. One more thing that were are about 200000 files in both directories to compare. The server is powerful enough. Can someone help to write a script? All the action is done in one server. The files are copied between serveral storages.
First i make file list of both directories with find, sed and cut and sort. Then compare two text files with diff or comm... the differences go to new text file. And then just copy the files from the list with cp. Maybe someone has good thoughts about how to speed up and put everything into one script?