How to copy just some subdirectories using filter rules
edacval at gmail.com
edacval at gmail.com
Tue Nov 9 10:46:44 MST 2010
On 11/09/2010 03:19 PM, Iñaki Baz Castillo wrote:
> 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.
>
rsync -vva --force --delete-excluded -f 'merge /etc/backup.filter' \
99.99.99.99:/ /home/server_backup/
/etc/backup.filter:
#-------------------#
+ /etc/
+ /usr/
+ /usr/local/
- /usr/*
+ /usr/local/etc/
+ /usr/local/bin/
+ /usr/local/sbin/
- /usr/local/*
- /*
#------------------#
More information about the rsync
mailing list