Including Specific files n levels deep

Wayne Davison wayned at samba.org
Sat Feb 14 00:01:56 GMT 2004


On Fri, Feb 13, 2004 at 11:41:15PM +0000, Andrew Liles wrote:
> OK, but I have an arbitrary structure, i.e.

Note that you didn't mention what was wrong with that original
invocation you cited, so I'm left to assume that you didn't like all the
extra empty directories that would get transferred.  There are ways to
work around that, though.

Are all the files you want to process at the same depth?  If so,
something very similar to what you suggested in your first post should
work fine:

% cat incl.txt
+ /*/
+ /*/Build
+ /*/Build.out
+ /*/Install*
- *
% rsync -tv --include=incl.txt /home/build/ /backup/build/

Another solution that works at any level and only transfers the
directories necessary to hold the files you want to transfer is:

% cd /home/build
% find . -name Build -o -name Build.out -o -name 'Install*' |
    rsync -tv --files-from=- . /backup/build/

..wayne..


More information about the rsync mailing list