Help needed with filtering rules - how to copy named directories only

Tue Oct 18 12:03:17 GMT 2005


I'm sure what I'm trying to achieve is remarkably easy, but I just can't
figure it out.  What I want to do is to copy all directories named lib (and
their contents) over to a local drive.  It's currently a pull operation, but
I could set it up as a push.

I've read the man page twice, looked at the FAQ, examples and searched on
google but no joy.

My command looks like the following:

$RSYNC -vv --dry-run -a --rsync-path=$RSYNC --exclude-from=copy_control
<hostname>:/apps/IRDtools/pkgs /apps/IRDtools/pkgs

copy_control looks like this:

+ lib/
- *

This exludes everything as the parent directories are not matched so I've
also tried:

+ */
+ lib/
- *

But this copies a load of directories without "lib" somewhere in the path
which I don't want.  The only way I can think around this is to run on the
source server "find /apps/IRDtools/pkgs -name lib -type d" and pipe the
output of that into an rsync "--files-from=-" .   I haven't actually tried
this as the directory structure under /apps/IRDtools/pkgs can get quite big
and although I'm not overly concerned about speed it would be neater to do
this all within rsync.  A sample directory is below:


I want to copy this to the same path on the local machine.  Anyone got any

Help much appreciated,

David Carter-Hitchin.

The Royal Bank of Scotland plc. Registered in Scotland No 90312.       Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.                                      
Authorised and regulated by the Financial Services Authority     
This e-mail message is confidential and for use by the                      
addressee only. If the message is received by anyone other             
than the addressee, please return the message to the sender          
by replying to it and then delete the message from your                    
computer. Internet e-mails are not necessarily secure. The               
Royal Bank of Scotland plc does not accept responsibility for          
changes made to this message after it was sent.                              
Whilst all reasonable care has been taken to avoid the                   
transmission of viruses, it is the responsibility of the recipient to        
ensure that the onward transmission, opening or use of this             
message and any attachments will not adversely affect its               
systems or data.  No responsibility is accepted by The Royal           
Bank of Scotland plc in this regard and the recipient should carry   
out such virus and other checks as it considers appropriate.           
                                                                                                               Visit our websites at:                                                                                                                                                                         

More information about the rsync mailing list