Syncing a single file and keeping N levels of folder structure

Viewed 2501

I have the following structure:

/Users
  /build
    /.jenkins
      /jobs
         /Job1
           config.xml
           someotherfiles.blah
         /Job2
           config.xml
           someotherfiles.blah
         /JobN
           config.xml
           someotherfiles.blah

I want to backup only the config.xml file to another folder keeping the folder structure the same in the new folder, but pruning away /User/build/.jenkins/jobs

My new folder would look like this:

backup/
  /Job1
    config.xml
  /Job2
    config.xml
  /JobN
    config.xml

Is this possible to do using rsync?

Edit: had accidentally included the someotherfiles.blah in the output, I actually don't want those. All I want is the config.xml file along with the folder structure 1 level up.

3 Answers
Related