include exclude help please.

Joe Rice jrice at
Thu Mar 21 04:03:09 EST 2002

tim.conway at at, Mar 19, 2002 at 12:53:44PM -0700:
> My mistake.  I never use the patterns in my application, so i forgot one 
> of the gotchas in the doc.
> From rsync.1:
>      If you end an exclude list with  --exclude  '*',  note  that
>      since  the  algorithm is applied recursively that unless you
>      explicitly include parent directories of files you  want  to
>      include  then  the  algorithm will stop at the parent direc-
>      tories and never see the files below them.  To  include  all
>      directories, use --include '*/' before the --exclude '*'.
> I think that if i were you, I'd use
> rsync -a --include='*.tif' --exclude '*' --relative `find /film/jonah 
> -type d -name sourceimages -print` /tmp

in response to the doc snippet, i have tried:

rsync -avv -include "/film/jonah/**/sourceimages/" --include "*.tif" --exclude "*" /film /tmp
rsync -avv -include "/jonah/**/sourceimages/" --include "*.tif" --exclude "*" /film /tmp

which both should match the directory, then the tif in that directory before
getting to the final exclude of "*".

The --relative 'find ' trick didn't work, but i still have to play
with it some to see if i can get it to work.

> On the other hand, as this is all local anyway, if you have gtar, why not 
> (cd /film; find jonah -type f -name '*.tif' -print |grep '/sourceimages/' 
> |tar --files-from=- ) |(cd /tmp;tar -xvf -)
> Note:  in this case, since the intervening directories aren't in the 
> archive, they are created at your umask and ownership, so you probably 
> want --owner= --group= and --mode= if you intend for others to have access 
> to them.

this is a good idea, but i'm only doing things local now in preparation for
doing them over rsync.  /film is a NFS mount.  I'm trying to move all the
tif's that reside in a sourceimages directory to the local machine. then
i plan on using the same rsync command to periodically check to see if there
has been any changes in any of the tif's.

> rsync is awesome, but uses a lot of memory with a lot of files, so there's 
> no real advantage to using it in your situation. does you a lot of first list build of all the *.tifs took
up 1.5 Gigs of my memory.

Thanks again for all your help,

More information about the rsync mailing list