CARTER-HITCHIN, David, FM
2005-Oct-18 12:03 UTC
Help needed with filtering rules - how to copy named directories only
Hi, 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=/apps/IRDtools/pkgs/pd/rsync/prod/bin/rsync $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: /apps/IRDtools/pkgs/pd/boost/prod/lib I want to copy this to the same path on the local machine. Anyone got any ideas? Help much appreciated, David Carter-Hitchin. --LongSig *********************************************************************************** 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: http://www.rbs.co.uk/CBFM http://www.rbsmarkets.com ********************************************************************************
Wayne Davison
2005-Oct-18 20:01 UTC
Help needed with filtering rules - how to copy named directories only
On Tue, Oct 18, 2005 at 01:03:17PM +0100, CARTER-HITCHIN, David, FM wrote:> 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=-".Yes, that's the only solution that avoids creating a lot of empty dirs at the moment. The closest you can get with include/exclude rules is something like this: + */ + lib/* - * That would copy the immediate contents of all "lib" dirs, and also the entire hierarchy of directories. If you want all the contents from the subdirs under "lib", you would need to change "lib/*" to "lib/**". ..wayne..