Help on rsync delete option
jw schultz
jw at pegasys.ws
Fri Nov 1 17:20:02 EST 2002
On Fri, Nov 01, 2002 at 11:36:56AM -0500, Chaturvedi.Rajesh wrote:
> Hello,
>
> Any help on the following issue will be appreciated.
>
> How do I delete files or directories in my first level of directory that is
> specified as host. Here is an example :
>
> rsync -avz --delete ${SOURCE_HOST}:/mlinkfam/extract/sccs/pa/*
> /mlinkfam/extract/sccs/pa
>
> Giving above command I find redundant files or directory not getting deleted
> from the first level of target directory /mlinkfam/extract/sccs/pa. However,
> files or directories do get deleted from subdirectories
> /mlinkfam/extract/sccs/pa/qa or /mlinkfam/extract/sccs/pa/field.
This isn't windows. Your shell is responsible for globbing.
To spell that out lets assume this the source host looks
something like so (i'm shortening the paths for readabilty) :
/sccs/pa
/sccs/pa/qa
/sccs/pa/qa/file1
.
. lots of other files and subdirs in pa/qa
.
/sccs/pa/field
.
. lots of other files and subdirs in pa/field
.
/sccs/pa/configdoodle
and the destination host has a file pa/oldanddeleted
/sccs/pa/oldanddeleted
in addition to the other stuff.
When you execute
rsync -avz --delete /sccs/pa/* ${DEST_HOST}:/sccs/pa
The shell will glob to produce
rsync -avz --delete /sccs/pa/qa /sccs/pa/field /sccs/pa/configdoodle ${DEST_HOST}:/sccs/pa
Which is the equivalent of
rsync -avz --delete /sccs/pa/qa ${DEST_HOST}:/sccs/pa
rsync -avz --delete /sccs/pa/field ${DEST_HOST}:/sccs/pa
rsync -avz --delete /sccs/pa/configdoodle ${DEST_HOST}:/sccs/pa
In order to make this more readable i changed this to a push
the behavior and shell stuff will still apply. The glob of
a remote source will be done by a shell on the remote host.
You haven't instructed rsync to operate on sccs/pa or on the
contents of sccs/pa but on a list of files and directories
that happen to be in sccs/pa. Also of note, no dot files in
sccs/pa will be synced because * doesn't match any filename
starting with dot.
rsync -avz --delete ${SOURCE_HOST}:/sccs/pa/ /sccs/pa
Will do what i think you want. All the contents of sccs/pa
will be synced.
--
________________________________________________________________
J.W. Schultz Pegasystems Technologies
email address: jw at pegasys.ws
Remember Cernan and Schmitt
More information about the rsync
mailing list