Possible Duplicate:
Rsync filter: copying one pattern only
I would like to use rsync to transfer all files from a server (or server-via-ssh) which have a specific ending string, such as a file type extension like tar.gz
. I want them all regardless of how deep they might go, now, or in the future. But this can be more than just the extension. In one case I want to get all files ending in -server-cloudimg-amd64-root.tar.gz
. And equally important I do not want to get any other files at all, even if they are at shallower paths.
The simple case of --include="**/*-server-cloudimg-amd64-root.tar.gz
does not get them. I do know rsync include/exclude is not simple and did not expect that to work. I know there is some need to specify directories to also be transferred. But rsync's logic has been a perpetual mystery to me (not like any path ACL rules I've ever seen) because of the fact that it also requires matching parent directories separately. I think what is needed is simply an option with the semantics that says "if this file matches, include all necessary directories to make it transfer without implying anything else matches" in much the same way the command mkdir -p ${DIRNAME}
would create the parents of the named directory as needed. I see no such option in rsync. Is there some straightforward way to do this in one pass?
-m
option will do the job, I have edited my answer. – Paweł Rumian Sep 08 '12 at 20:44