Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-23-2011, 02:51 PM   #1
LQ Newbie
Registered: Nov 2011
Posts: 1

Rep: Reputation: Disabled
RSYNC Help - Copy Only Changed Files to New Directory

Hello everyone. I'm having an issue achieving the result I want using rsync. This is the scenario I'd like to achieve:

I pull the contents of a directory from a remote system, and store that in directory called "Baseline". I then recheck that remote system periodically and pull back ONLY the files that have changed, and place them into another directory called "Diff-<date>". In a more graphical representation, this is what I'm looking for:

Remote Server: File1 File2 File3

I run rsync and populate the Baseline folder, with:
Baseline: File1 File2 File3

Then, something changes on the remote server.
Remote Server: File1 File2 File3 File4 NewDirectory

I want to compare whats now on the server, with the contents of Baseline, and place only those changes in the Diff folder, so I'd only end up with the following in Diff:

Diff-<date>: File4 NewDirectory

Then if I recheck the remote system again, and notice another change, I want to be able to compare that and again add only that changed file to a new Diff-<date> folder.

I've tried various methods with rsync to create these incremental backups, and while they do work and contain the changed files, it also contains all the other files as well.

So as of now, if I have:
Remote Server: File1 File2 File3

And run rsync, I get
Baseline: File1 File2 File3

If remote server changes to:
Remote Server: File1 File2 File3 File4 NewDirectory

I end up with
Diff-<date>: File1 File2 File3 File4 NewDirectory

Instead of
Diff-<date>: File4 NewDirectory

If remote server changes again to
Remote Server: File1 File2 File3 File4 NewDirectory NewDirectory2

I end up with
Diff-<date>: File1 File2 File3 File4 NewDirectory NewDirectory2

Instead of the following, as I'd like
Diff-<date>: NewDirectory2

Hopefully that makes sense. Is there any way around this, or is rsync not the right method?

I have a BASH script written now, that when I run it, it creates incremental backups and places them into a folder. Is there a way to compare those incremental backups with one another, and then just copy out the changed files? One thing I noticed with my bash script now is that the incremental backups seem to be a revision behind. So if I make a change, it gets sync'd to the destination folder, and then an incremental backup is created of the previous states. When i run the script again, then the newest change is populated into another incremental backup. This may be normal operation, but im not sure.

Thanks for the help.
Old 11-23-2011, 03:29 PM   #2
Senior Member
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217

maybe if you have done it so far with rsync you could use rdiff-backup which implements use of rsync.

good luck.


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
rsync copying everything not only changed files with luks encrypted drive changcheh Linux - General 1 09-10-2011 09:44 PM
using rsync to copy only certain folders within a directory structure Ryanjon7 Programming 5 06-20-2011 02:34 PM
[SOLVED] shell script to copy newly changed files with rsync genderbender Programming 15 04-22-2010 07:27 AM
Copying whole changed files - rsync? deadlock Linux - Software 2 12-04-2007 04:57 AM
rsync syntax to skip directory, but copy select files.. tnicol Linux - Software 3 07-24-2007 05:40 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:00 AM.

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