Transfer files matching a pattern

Matt McCutchen matt at
Tue Nov 13 19:45:11 GMT 2007

On Tue, 2007-11-13 at 17:42 +0100, Paul Slootman wrote:
> 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,

It can be achieved with --prune-empty-dirs .

> but ignoring that, this is
> how I'd do it:
> rsync -an --progress --include '*/' --include '*.log' --exclude '*' /var
> But if you're using --files-from anyway, why not use find to get the
> list of files and don't let rsync recurse...

Why find ?  It seems to me that one would do:

grep '\.log$' /tmp/source | rsync <blah> --files-from=-


More information about the rsync mailing list