PDA

View Full Version : help with bash


templas
3rd July 2008, 08:12
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?

Thanks:confused:

topdog
3rd July 2008, 18:57
why waste your time scripting that when you can just use rsync ?

templas
4th July 2008, 07:55
i don't need files to be moved between serverts, i nedd them to be moved between storages(different partitions)

topdog
4th July 2008, 13:08
rsync can still do that.

templas
4th July 2008, 14:43
but still were are 200K of files, how to speedup the process?

topdog
4th July 2008, 14:49
actually if by 200k you mean 200 thousand, you will not be able to do that with a script as the number of arguments most commands can take is limited.

Still i don't see how a script that is being interpreted can be faster than a binary program

sjau
4th July 2008, 18:19
I'd also go for rsync

quentin
8th July 2008, 13:27
Definately use rsync.