rsync for the brave

Matt McCutchen matt at
Mon Nov 10 01:54:21 GMT 2008

On Sun, 2008-11-09 at 17:50 -0700, Ashley M. Kirchner wrote:
> Matt McCutchen wrote:
> > I'm surprised that the exclude doesn't work.  Could you post your whole
> > rsync command line so I can see if anything else might be interfering?
>     Keep in mind that this is the Win32 ported version (cwRsync) that 
> I'm using.
>     "C:\Program Files\cwRsync\bin\rsync.exe" -arvz --progress --partial \
>      --delete --delete-excluded --exclude="Network Trash Folder"        \
>      --filter=". C:\Program Files\cwRsync\filter.txt"                   \
>      --log-file="C:\Program Files\cwRsync\AbyssI.txt"                   \
>      /cygdrive/f/ /cygdrive/y/
>     I've tried adding it to the command line (see above), and when that 
> failed, I moved it into the filter.txt file instead:
>         C:\Program Files\cwRsync>type filter.txt
>         - .*
>         - ICON*
>         - RECYCLE*
>         - System Volume Information
>         - Temporary Items
>         - TheFindByContentFolder
>         - TheVolumeSettingsFolder
>         - Network Trash Folder
>         - msdownld.tmp
>         C:\Program Files\cwRsync>
>     I'm not using both at the same time, it's either the command line, 
> or filter.txt file.  Neither seem to work.  What rsync is telling me is 
> that it wants to DELETE the copy that's on the Y: drive (since it 
> doesn't exist on the F: drive).  However, I need it to ignore that 
> folder all together, don't bother copying, don't bother deleting.

--delete-excluded prevents the --exclude="Network Trash Folder" rule
from protecting the "Network Trash Folder" on the destination from
deletion; that's the whole point of --delete-excluded.  To protect this
directory, you'll need to use a rule that explicitly applies to both the
sender (s) and the receiver (r):

--filter="-sr Network Trash Folder"

See the descriptions of the "s" and "r" modifiers under 'The following
modifiers are accepted after a "+" or "-"' in the man page for more

By the way, if some of your excludes are intended to match only files at
the top level of F: (rather than in a subdirectory), consider anchoring
them with a leading slash, e.g.:

--filter="-sr /Network Trash Folder"


More information about the rsync mailing list