rsync command exclude option

Michal Soltys soltys at ziu.info
Thu Nov 27 17:02:05 GMT 2008


Kaushal Shriyan wrote:
> 
> Hi again
> 
> I have a directory logfiles and inside it it has lots of sub 
> directories. Inside it there are lots of .gz, .txt and .sql files
> I want only .sql files to be rsynced to the destination host
> 
> is there a way to achieve it using rsync utility
> 

Assuming you won't be deleting on the receiving side:

file .rf:

+ *.sql
+ */
- *

rsync -avm --filter='., .rf' <source> <destination>

This is actually identical example to what you can find in rsync's 
manual at the description of -m option. Delete variant would probably be 
of use for you as well. And - depending on specific needs - there're 
other possibilities.


ps.

Please take a look at http://www.samba.org/ftp/rsync/rsync.html whenever 
you have time. Rsync grants /a lot/ of flexibility, but can be pretty 
subtle at times as well.


More information about the rsync mailing list