How to copy just some subdirectories using filter rules

Iñaki Baz Castillo ibc at aliax.net
Tue Nov 9 06:19:54 MST 2010


Hi, I always find the same problem when trying to properly configure
my remote backups so have decided to ask here since, surely, I miss
something :)

I just want to copy some directories (and their full content) from a
server to my PC. This is what I "try" to use:


rsync -vv -a --relative --delete --force --delete-excluded \
         --include-from=/etc/backup.filter \
           99.99.99.99:/   /home/server_backup/


/etc/backup.filter:
--------------------------------------
+ /etc/
+ /usr/local/etc/
+ /usr/local/etc/
+ /usr/local/bin/
+ /usr/local/sbin/
- /*
--------------------------------------


However when running the command just /etc/ dir is copied.

In order to, for example, copy /usr/local/etc/ I wouldn't like to do:
--------------------------------------
- /usr/lib/
- /usr/include/
- [...]
- /usr/local/bin/
- /usr/local/sbin/
- /usr/local/share/
- [...]
+ /usr/local/etc/
--------------------------------------

For sure I miss something cool to achieve what I want, but have never
found it. Any suggestion please?

Thanks a lot.

-- 
Iñaki Baz Castillo
<ibc at aliax.net>


More information about the rsync mailing list