IƱaki Baz Castillo
2010-Nov-09 13:19 UTC
How to copy just some subdirectories using filter rules
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>
edacval at gmail.com
2010-Nov-09 17:46 UTC
How to copy just some subdirectories using filter rules
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/* - /* #------------------#