--prune-empty-dirs option not doing the job

Matt McCutchen matt at mattmccutchen.net
Wed Mar 3 19:12:24 MST 2010

On Wed, 2010-03-03 at 20:41 -0500, Matt McCutchen wrote:
> On Wed, 2010-03-03 at 17:29 -0800, js_spamfree-rsync at yahoo.com wrote:
> > test command:
> > rsync -avm --del --prune-empty-dirs
> > --compare-dest=/Users/generic/Desktop/B /Users/generic/Desktop/A/ /Users/generic/Desktop/C
> > 
> > produces a large number of directories and nested directories on the
> > destination that are empty.  i've tried tweaking so many different
> > combinations of options i'm beginning to lose track!  none of them
> > produce the proper result in the destination directory.  
> This is a known issue:
> http://lists.samba.org/archive/rsync/2009-October/023981.html

On second thought, that reference does not completely answer your

With --compare-dest, rsync skips the creation of files in the
destination if they are matched in the --compare-dest dir, but the files
are not actually removed from the file list.  Thus, --prune-empty-dirs
sees the directories as nonempty and does not prune them.
--compare-dest is a transfer rule in the sense described here:


Given that the directories aren't pruned, one might still hope they
would be skipped because they are matched in the --compare-dest dir (at
least if --omit-dir-times is on).  Why that doesn't happen is the
subject of the reference I originally gave.


More information about the rsync mailing list