rsync cannot delete non-empty directory
Use the p
modifier:
A p indicates that a rule is perishable, meaning that it is ignored in directories that are being deleted. For instance, the -C option’s default rules that exclude things like "CVS" and "*.o" are marked as perishable, and will not prevent a directory that was removed on the source from being deleted on the destination.
For example, I use the -F
option, which "tells rsync to look for per-directory .rsync-filter files that have been sprinkled through the hierarchy and use their rules to filter the files in the transfer."
My .rsync-filter
contains lines like these to filter out these "droppings" that Macs leave behind them:
-p .DS_Store
-p ._*
If using exclude
instead of just -
, add a comma. For example :
exclude,p .DS_Store
exclude,p Thumbs.db