rsync directories that match a string

Matt McCutchen hashproduct+rsync at
Wed Sep 5 01:04:16 GMT 2007

On 9/4/07, Jason Lewis <jasonblewis at> wrote:
> Basically I want to copy all files from
> oldserver/home/$USERS/Maildir/new  to newserver/home/$USERS/Maildir/new
>    where the $USERS represents all the user's home folders.
> this is what I have tried but its not working:
> rsync --dry-run -vaxuHS \
>         --filter='+ */Maildir/***'    \
>         --filter='- **'   \
>         "rsync://home@*" /home/

Excluding a directory stops rsync from traversing the stuff inside.
The second rule matches and excludes the home directories, so rsync
never notices that the Maildirs inside are included.  This is a very
common mistake described in the man page (search for "ineffectual").
To fix the command, you could add a filter to the beginning of the
list that includes everything at the top level (i.e., the home
directories): --filter='+ /*'.


More information about the rsync mailing list