Rsync copy directory contents but not directory itself

Tombart picture Tombart · Nov 30, 2013 · Viewed 55.4k times · Source

I'm trying to synchronize two contents of folders with different name:

rsync -av ~/foo [email protected]:/var/www/bar

I'd like to copy the content of foo into bar at remote host, but not the directory foo itself. I've tried something like foo/*, but rsync doesn't support that.

rsync always creates

/var/www/bar/foo

Answer

Protostome picture Protostome · Nov 30, 2013

Try rsync -av ~/foo/ [email protected]:/var/www/bar/