Super User is a question and answer site for computer enthusiasts and power users. 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 want to rsync dirs includes files from path to another exact path that has been rsynced from it

For example :-

path 1 have

dir1/
dir1/mysql
dir1/log1
dir1/log2
dir1/log3
dir1/home

want to rsync mysql and home directories only but will be rsync with the same path name

so the result in the rsync place

dir1/
dir1/mysql
dir1/home

hope someone help me with the right rsync comand

share|improve this question

migrated from stackoverflow.com Jul 20 '12 at 1:55

This question came from our site for professional and enthusiast programmers.

Something like this?

rsync -av  origin/{home,mysql} destination/
share|improve this answer
    
what if home into another directory no mysql and home under same directory ? like dir1/dir2/home and mysql will be dir1/mysql – iLinux85 May 19 '12 at 15:25
    
you can nest {d1,d2{dx,dy}} as you like. If things become too complex you can put directories in a text file and use --files-from=whattorsync.list or call rsync multiple times from a script. – dschulz May 19 '12 at 15:54
    
sorry the main command you post didn't rsync the home and mysql directories – iLinux85 May 27 '12 at 9:11
    
sorry, I assumed your shell is bash. – dschulz May 27 '12 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .