Using rsync filter to include specific, deep subdirectories under source path?

Dmt Ops opsdmt at gmail.com
Thu Jan 30 11:22:07 MST 2014


I'm trying to get rsync filters working -- and understood.

My current, simple test script is

    ----------------------------------------------
    #!/bin/bash

    ROPTS="--verbose --progress --itemize-changes \
     --recursive \
     --links \
     --perms \
     --times \
     --group \
     --owner \
     --devices \
     --specials \
      --acls \
      --xattrs \
    --human-readable \
    --numeric-ids \
    --relative \
    --delete-after \
    --delete-excluded \
    --iconv=UTF-8,UTF-8 \
    "

    /usr/bin/rsync ${ROPTS} --filter="merge /home/test.filter"
root at my.remote.com:/ /home/TEST
    ----------------------------------------------

My 1st goal is to successfully filter to JUST backup "/boot", and all its
contents, give a SRC entry point of "/".

If I populate the filter file,

    cat << EOF >> /home/test.filter
    + boot/
    -sr /*
    EOF

and exec the script, I end up with

    ls -1 /home/TEST
        boot/

    du -h --max-depth=0 /home/TEST/boot/
        32M     /home/TEST/boot/

where the boot/ IS fully recursively populated with its files & subdir
contents.

So that works.

Next, I'd like to JUST backup two, specific subdirectories below /boot;
specifically /boot/grub & /boot/grub2.

Changing the filter If I add a file exclusion to the filter

    cat << EOF >> /home/test.filter
    + boot/grub/
    + boot/grub2/
    -sr /*
    EOF

and re-exec the script, now, nothing is rsync'd -- no files or dirs are
transferred

Why doesn't the filter work for the subdirs?

How DO I filter to get just the subdirs of choice to rsync?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20140130/6203ea27/attachment.html>


More information about the rsync mailing list