rsync walks through excluded directories...

Jean-Christophe Guillain jc.guillain at gmail.com
Wed Mar 16 01:31:43 MDT 2011


On Tue, Mar 15, 2011 at 5:20 PM, Wayne Davison <wayned at samba.org> wrote:
>
> On Tue, Mar 15, 2011 at 7:41 AM, Jean-Christophe Guillain <jc.guillain at gmail.com> wrote:
>>
>> $ rsync -aH --del --ignore-errors --filter="- /lost+found/*" --filter="- /.snapshot/*" /data/orig_disks/vol-opt/ /data/bckp_disks/vol-opt/
>
> Note that it is more efficient to leave off the trailing '*' so that the directory is excluded rather than the contents of the directory.  With the '*', rsync has to list the dir's contents and see if it matches the exclude or not.  However, that has the side effect of not creating (empty) lost+found and .snapshot dirs on the destination if they don't already exist.

Yes, I wanted the empty directories to be created, but not their contents.

>>
>> rsync     1599        root    3r      DIR               0,25    12288   12117707 /data/orig_disks/vol-opt/opt/.snapshot/some/directory/somefile
>
> That .snaptshot doesn't match your excludes since it's down inside the opt subdir, not at the root of the transfer.  If you want to exclude .snapshot dirs anywhere in the tree, leave off the leading slash.  If you want to exclude that dir in particular, add the missing /opt prefix.

Dammit ! I think I read this line twenty times and I never noticed the
"double" opt... I didn't know there were other .snapshot directories
in the three, and I want to exclude their contents too. I'll leave off
the leading slash.

Thank you very much for your answer,

jC


More information about the rsync mailing list