help with bash

Discussion in 'Programming/Scripts' started by templas, Jul 3, 2008.

  1. templas

    templas New Member

    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:
     
  2. topdog

    topdog Active Member HowtoForge Supporter

    why waste your time scripting that when you can just use rsync ?
     
  3. templas

    templas New Member

    i don't need files to be moved between serverts, i nedd them to be moved between storages(different partitions)
     
  4. topdog

    topdog Active Member HowtoForge Supporter

    rsync can still do that.
     
  5. templas

    templas New Member

    but still were are 200K of files, how to speedup the process?
     
  6. topdog

    topdog Active Member HowtoForge Supporter

    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
     
  7. sjau

    sjau Local Meanie Moderator

    I'd also go for rsync
     
  8. quentin

    quentin New Member

    Rsync

    Definately use rsync.
     

Share This Page