directory Syncing

Bill Warner wwarner@direct-alliance.com
22 Sep 2000 02:41:41 +0700


> Bill Warner wrote:
> > 
> > Sorry if this is like the 5th time this gets posted
> > but I am not seeing my mail go through to the list even
> > after 3-4 hours.  It might be my end but I have been
> > able to send a few test messages to other lists and my
> > self.
> > 
> > Anyway,
> > 
> > what is the best way to get rsync capabilities between
> > two local directories.  such as /foo and /bar need to be
> > synced.  I have looked at rsync and rdist but both seem
> > to be for syncing across two or more hosts and not for
> > just two directories.  Searching on freshmeat turned up
> > pretty much nothing, but I am not sure exactly what I should
> > be looking for. be looking for.> >
> 
> #!/bin/bash
> #
> CURRENTDIR=`pwd`
> cd $2
> TARGETDIR=`pwd`
> cd $CURRENTDIR
> cd $1
> shift
> shift
> # allow passing of arguements to the extracting tar, such as keep
> existing files, etc
> tar -cvf - * | tar $@ -xvC $TARGETDIR -f -

This seems to be close to what I need. A few questions.
this doesn't seem to account for if i have /foo/test and
/bar/test and sync them it still copies test over.  I
only want it to copy if they have changed or if it doesn't
exist.  Also would be ince if I was trying to sync /foo to
/bar if it would delete all files if /bar that were not
in /foo.

I will try building on what you sent me though, one question
what is the shift for I am not familiar with that. 
--
Bill Warner
Direct Alliance Corp.
Unix/Linux Admin.