I want to copy directory
foo from server A to server B.
what is the way to do it using rsync?
foois a large directory so I need the copy will be fastest as possible.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.
Failing that, compress foo and copy the resulting archive over SSH using scp to your new server, then extract it.
tar -cvzf foo.tar /path/to/foo scp foo.tar you@newserver:/path/to/wherever (I'd put it in /tmp) tar -xvzf foo.tar -C /path/to/foo