include/exclude directory question

Dave Dykstra dwd at bell-labs.com
Sat Nov 17 03:04:30 EST 2001


On Thu, Nov 15, 2001 at 04:38:26PM -0800, Dave Madole wrote:
> 
> I want to send a subset of directories sepcified in "include" arguments
> to a client, but I am creating all the
> peer and parent directories as well, although they are empty - here is
> basically what I'm doing.
> 
> assuming I have /staging/upgrade/dir1, /staging/upgrade/dir2 and
> /staging/upgrade/dir3 on the source tree.
> 
> --include "*/" -include upgrade/dir1/** -include upgrade/dir3/**
> -exclude "*" /staging/* /
> 
> what I get on the client is
> 
> /ugrade/dir1/*
> /upgrade/dir2 (an empty directory)
> /upgrade/dir3/*
> 
> How can I get rsync to filter out and stop creating the empty dir2
> directory without specifucally excluding it?

Because of your --include "*/" you'll always get all the directories, empty
or not.  If you want to skip them, you'll need to individually include the
parent directories that you want to keep, in your example "upgrade/",
"upgrade/dir1/", and "upgrade/dir3/".  Sorry, but there's no other way
around it.

- Dave Dykstra




More information about the rsync mailing list