Thursday, October 18, 2012

rsync - folder to folder

rsync is wonder utility to sync files.

I had a situation and I was sure the developer must have thought of it. And I was right :) He had solved it with a trailing /

rsync [option] /home/foo/bar dest:/home/foo

will sync bar directory of source into destinations /home/foo.

Note: this requires access to /home/foo

Suppose you have /bar under root / of the destination and you want to sync the same source. Now this will get tricky as it is rare to have open access to /. The solution is

rsync [option] /home/foo/bar/ dest:/bar

The trailing / in the source syncs everything under bar and fits the solution to the problem.

No comments: