Synch only directory sturcture- Help

Hi All,

I am trying to synchronize two folders(test and test1) using rsync. "test" has some sub folders and all of the have some files also. I just want to sync the directory structure not the files in the first folder with the second. i tried the following script.

rsync -av --include '/' --exclude '' test/ test1/

its working fine. now my question is how to exclude only a hidden directory, say .ssh and all other files from each of the directories in the first directory. it would be a gr8 help if some one can help me in this..

You can use something like this:

cd <source> && find . -name .ssh -prune -o -type d -print |
 cpio -pd <dest>

Sorry, i need to know whether this is possible with rsync or not... bcoz once this is done, i can implement it between two servers.... Thanks for the reply...

I don't know if it's possible with rsync, but you can use cpio between different hosts with ssh.

Assuming the destination directory exists on the remote host:

cd <source> && 
  find . -name .ssh -prune -o -type d -print |
    cpio -oa | 
      ssh user@host 'cd <dest> && cpio -id'

any possibility with rsync? I cant go back to the junction again and take a new turn. :confused::confused:. it would be a great help...

i tried

rsync -av --include '*/' --exclude '*' --exclude '*/.ssh' test/ test1

but its not taking the first exclude...