Deleted remote directories not being removed locally

Wayne Davison wayned at
Fri Dec 2 20:48:57 GMT 2005

On Fri, Dec 02, 2005 at 03:21:13PM -0500, David Filion wrote:
> Why does the dry-run indicate the directory is deleted, but when run
> with out the dry-run flag, it is not?

An exclude has two actions:  it hides items on the server side, and it
protects items on the client side.  If a directory contains protected
items, it won't be deleted.  You can turn off the protection by using
--delete-excluded, or you can simplify your command by changing both
your include options (one of which is really an exclude) into a filter
command that just tells rsync to hide the non-directory server content
without protecting it on the client.  Your command would then look like
this (I made your options more compact and removed the redundant ones):

    rsync -rvb --del --backup-dir=$DELETEDIR --stats \
	-f 'hide,! */' $SERVER::'ucp/' .

The filter option tells rsync to hide all non-directories due to the
"not" ('!') attribute.  Also, the only time that a directory will appear
in the backup-dir you specified is if there is a non-directory that
needs to be backed up (since rsync doesn't backup dirs), so that is
probably useless in this context.


More information about the rsync mailing list