Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:




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
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


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.