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