How to transfer directory-structure diffs to multiple machines

John Schofield schof at dakim.com
Sun Mar 19 01:05:33 UTC 2006


I've been Googling, and haven't been able to come up with a pre-made  
solution for this particular issue.

Here's the problem:

I have a directory structure full of many thousands of files. This  
directory structure is updated on a regular basis. Many of these  
files are audio/video clips. The entire directory structure will  
eventually total several hundred gigs.

I want to mirror this directory structure to a large number of  
computers running Ubuntu. These computers will be outside my local  
network, so the data will travel over the Internet.

I could, of course, simply use rsync from each of the machines to the  
central server. Because of bandwidth concerns, I'm not too crazy  
about this approach.

So I've come up with a hybrid approach.

I have a "deployed" and a "staging" directory structure on my server.  
We make additions to the staging directory structure as they become  
ready. When we're ready to deploy the changes, we do so using the  
procedure outlined below, and then the current staging directory  
becomes the deployed directory. New changes are made to the staging  
directory.

So the procedure I've roughed out is:

1) We do a diff on the two directory structures, generating a list of  
changes -- based on this list, we generate a collection of new files,  
and a list of deletions and tar/bzip it up.

2) We distribute the tar archive to the various client machines using  
scripted BitTorrent.

3) Each client machine untars the archive and follows the  
instructions in it to add new files, delete old files, etc.


Looks like "diff -r --brief dir1 dir2" will get me a list of changes  
between two folder structures. (dircmp will do the same, but it  
doesn't seem to be part of Ubuntu or Debian.) I could write a shell  
or perl script to process those diff results, and generate the  
archive file. (And unpack the archive file on the other side.)

So, my questions basically boil down to the following:

Am I smoking crack? Does this seem a reasonable way to solve the  
problems I've outlined? Is there an easier way to do this? A utility  
I could use that already exists?

Thanks very much!





More information about the ubuntu-users mailing list