1

Hoping this is the right place to ask this...

I have a directory tree like this:

r/a/src/etc...
r/a/target/etc...
r/a/xyz/etc...
r/b/src/etc...
r/b/target/etc...
r/c/src/etc...
r/c/target/etc...

Ideally, what I need to do is to get the target directories, and their contents, to a remote server, preserving the overall tree structure. Like:

r/a/target/etc...
r/b/target/etc...
r/c/target/etc...

If it's possible to do this with rsync exclude/include/filters, I'm baffled. I'm hoping it's possible, though, since otherwise it's a bit of a pain.

Suggestions?

Thanks!

1

It should be simple using the following command:

$ rsync -aR r/*/target /destination

The /destination path can be local or on different machine. The -R option is important to preserve the tree structure. Only the target folders (with their contents) will be copied to /destination while preserving the tree structure.

  • Khaled - that's it; works like a charm. Not sure why I had so much trouble parsing the man page to figure it out. – denishaskin Jan 14 '12 at 16:59
  • It's ok. We are here to help each other. – Khaled Jan 14 '12 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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