Selective --delete

Paul Slootman paul+rsync at
Wed Jan 8 09:51:47 MST 2014

On Tue 07 Jan 2014, Ashley M. Kirchner wrote:
> On Tue, Jan 7, 2014 at 9:44 AM, Paul Slootman <paul+rsync at> wrote:
> > rsync will not touch files that have been --exclude'ed; unless you also
> > specify --delete-excluded . So just specify those LIVE-only files in
> > your exclude list.
> >
> Uh, that hasn't been my experience.  I just ran this and it happily deleted
> the events folder.  I did verify that it gets excluded during the sync
> portion as files that either exist or don't exist on either servers did not
> get synced or deleted, but it did, at the end, delete the entire folder and
> contents.

$ cd /tmp
$ mkdir rsync-src rsync-dst
$ mkdir rsync-dst/events
$ rsync -ai --delete --exclude /events/ rsync-src/ rsync-dst/
.d..t...... ./
$ ls -ld rsync-dst/events
drwxr-xr-x 2 paul paul 4096 Jan  8 17:49 rsync-dst/events

Your experience differs from mine...


More information about the rsync mailing list