Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to copy all the files named 'specials.xml' in the current and all subdirs, and also create the name of each sub-directory. I'm using -R to rsync so it creates the relative paths for each corresponding subdirecotry. For example, I want cp:

/home/deploy/admin_xml_files/foo.com/specials.xml
/home/deploy/admin_xml_files/bar.com/specials.xml

to:

~/adminxml/foo.com/specials.xml
~/adminxml/bar.com/specials.xml

but this isn't working:

$ mkdir ~/adminxml/
$ find /home/deploy/admin_xml_files -iname 'specials.xml' -exec rsync -aR ~/adminxml/ {} +

It's saying:

ERROR: destination must be a directory when copying more than 1 file. rsync error: errors selecting input/output files, dirs code 3) at main.c(543) [Receiver=3.0.7]...

It's probably something to do with the argument order of rsync, since it needs to be SRC DEST

share|improve this question

1 Answer 1

up vote 2 down vote accepted
$ mkdir ~/adminxml/
$ cd /home/deploy/admin_xml_files
$ rsync -avR $(find . -iname 'specials.xml') /path/to/adminxml/
share|improve this answer
    
Thanks, I was just about to try that after thinking more about the argument order. It works! Very nice. Thank you –  user40696 Nov 11 '11 at 0:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.