There are several solutions, and which one is right for you depends on
how new your rsync version is.  For instance, a way that works with any
rsync version is to copy from an empty dir to get rsync to do a
deletion:

  mkdir empty-directory
  rsync -av --delete --include=/dirb --exclude='*' empty-directory/ /tmp
  rmdir empty-directory

That tells rsync to only send dirb on the sending side (which is
missing) and protects everything except dirb on the receiving side.

I am not a fan of this solution. Indeed, what I want to setup is a system for copying a paraterable list of dirs (by some external config file), and also a list of dirs to remotely delete. The idea is to have a rsync script running in a crontab, unmodified, while the end users control their lists of dirs.

An alternate way to do this that also updates dira requires at least
version 2.6.4:  you can use a hide filter to make rsync transfer exactly
what you want and avoid deleting anything extra (because you don't need
to use --delete-excluded).  Like this:

  rsync -av --del -f 'hide /dirb' --include='/dir[ab]' --exclude='/*' . /tmp


OK, I will try this one.

But...
My original command was:
rsync -aR --exclude=dirb --exclude-deleted dira dirb /tmp

I would like to be able to use the -R switch, as the list of dirs will need to be of the form: */release-1.0, and I want that the '*' part be kept on the remote site.

Can you explain me what is wrong with this specific command?
I thought that mentioning dirb in the list of copied dirs would make the --exclude switch work (at least taken into account). With --exclude=dirb/** I managed to get a remote empty dirb, what is still missing is removing dirb itself.

Thanks,

Christophe.
--
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to