0

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

user40696
  • 113
  • 5

1 Answers1

2
$ mkdir ~/adminxml/
$ cd /home/deploy/admin_xml_files
$ rsync -avR $(find . -iname 'specials.xml') /path/to/adminxml/
quanta
  • 51,413
  • 19
  • 159
  • 217
  • 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 00:41