Transfer files matching a pattern

Paul Slootman paul+rsync at wurtel.net
Tue Nov 13 16:42:11 GMT 2007


On Tue 13 Nov 2007, Ismaël BALLO wrote:
> 
> 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

That last restriction is a bit of a spoiler, but ignoring that, this is
how I'd do it:

rsync -an --progress --include '*/' --include '*.log' --exclude '*' /var 10.156.1.1:/home/toto

But if you're using --files-from anyway, why not use find to get the
list of files and don't let rsync recurse...


Paul Slootman


More information about the rsync mailing list