How to avoid copying empty directories?

btang at pacific.jpl.nasa.gov btang at pacific.jpl.nasa.gov
Thu Nov 29 07:24:42 EST 2001


Dave Dykstra wrote:
> 
> On Tue, Nov 27, 2001 at 04:03:58PM -0800, btang at pacific.jpl.nasa.gov wrote:
> > rsync -avu --include 'tmp1/*/*.c' --include "*/" --exclude "*" tmp1 tmp2
> >
> > The above command copies all the empty directories under tmp1/ . Is there
> > any way to avoid it?
> 
> Currently the only way is to explicitly include the parent directories
> you want instead of --include "*/".
> 
> - Dave Dykstra


For the above exemple, I can do

rsync -avu --include 'tmp1/*/*.c' --include "tmp1/*" --include "tmp1/" --exclude "*" tmp1 tmp2


But this still copies the empty directories "tmp1/*" that don't have "*.c" in them.




More information about the rsync mailing list