LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Syncing Files (https://www.linuxquestions.org/questions/linux-server-73/syncing-files-909781/)

sparkshankar 10-24-2011 06:51 AM

Syncing Files
 
Hello,

We have to sync 2 directories. The problem is both the directories are huge. Directory A is 40GB and Directory B is 3 GB. We want to sync Directory B to A. We would like to do the following:

1) Both A & B has lot of same files and directories with different time stamps. If B has an updated directory or file we would like to sync that to A ( overwriting those in A ) . If A has the updated one, then that file shouldn't be synced.

2) Sync all files / Directories in B that are not present in A to A.

3) We have to ensure no data loss.

How is this done? Can this be done with "rsync". Please provide the different options of rsync for this.

Regards
Shankar

SecretCode 10-24-2011 07:16 AM

Yes, rsync is very good for this.

Read Everything Linux - A Tutorial on Using Rsync and rsync examples (and other pages at rsync.samba.org).

Then study man rsync.

sparkshankar 10-24-2011 11:15 AM

Hello,

thanks for the reply

1) ".............................If A has the updated one, then that file shouldn't be synced."


can this be achieved with rsync? how is this done ? "-c" option with rsync?


regards
Shankar

SecretCode 10-24-2011 01:11 PM

You want the option
Code:

-u, --update                skip files that are newer on the receiver

David the H. 10-24-2011 05:29 PM

You might want to look into using unison instead. This sounds like just the kind of thing it's designed for:

http://www.cis.upenn.edu/~bcpierce/unison/

sparkshankar 10-25-2011 03:31 AM

Thank You SecretCode! -u option did the trick

Appreciate it.

Regards
Shankar


All times are GMT -5. The time now is 01:31 PM.