Transfer files matching a pattern

Ismaël BALLO isma.ballo at gmail.com
Tue Nov 13 15:29:06 GMT 2007


Hello,

I've googled but not found exactly what I want.
I want to transfer *.log from all directories and subdirectories of /var.
Directories have to be created remotely only if files match

How do you do  this ?

I try
rsync -an --progress --files-from=/tmp/source --filter=":
/tmp/pattern" / 10.156.1.1:/home/toto

where
/tmp/source contains
/var

and
/tmp/pattern contains
*.log



It gives me that :

var/
var/log/
var/log/Xorg.0.log
var/log/Xorg.0.log.old
var/log/aptitude
...
var/log/daemon.log.1.gz
var/log/daemon.log.2.gz
var/log/daemon.log.3.gz
var/log/debug
var/log/debug.0
var/log/debug.1.gz
var/log/debug.2.gz
......
var/log/fsck/
var/log/ksymoops/
var/log/news/
var/log/samba/

By example(here), I don't want :
var/log/Xorg.0.log.old
var/log/daemon.log.1.gz, etc...

Thx in advance


More information about the rsync mailing list