LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-24-2011, 06:51 AM   #1
sparkshankar
Member
 
Registered: Aug 2009
Posts: 30

Rep: Reputation: 15
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

Last edited by sparkshankar; 10-24-2011 at 08:37 AM.
 
Old 10-24-2011, 07:16 AM   #2
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
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.
 
Old 10-24-2011, 11:15 AM   #3
sparkshankar
Member
 
Registered: Aug 2009
Posts: 30

Original Poster
Rep: Reputation: 15
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
 
Old 10-24-2011, 01:11 PM   #4
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
You want the option
Code:
 -u, --update                skip files that are newer on the receiver
 
Old 10-24-2011, 05:29 PM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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/
 
Old 10-25-2011, 03:31 AM   #6
sparkshankar
Member
 
Registered: Aug 2009
Posts: 30

Original Poster
Rep: Reputation: 15
Thank You SecretCode! -u option did the trick

Appreciate it.

Regards
Shankar
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Buffalo NAS - how do we get files on NAS syncing with Windows Sync? bykerbob Linux - Newbie 0 10-21-2008 08:59 PM
Syncing very large number of files to another server humbletech99 Linux - General 1 07-18-2008 07:58 AM
syncing two folders where files sourcefiles without brackets[] and target files with Byenary Linux - Networking 0 04-08-2008 02:14 AM
Unison has found/created odd named files. I'm also after basic syncing advice. Mysticle31 Linux - Server 0 01-16-2008 11:50 AM
KSH: syncing three files the hard way ReefShark Programming 1 07-31-2005 10:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration