rsync syntax

I am trying to setup an rsync script to sync files over the network.

I have files in a directory "my_dir".

I want those files copied to "remote_host:other_dir_name".

My command is: rsync -aR my_dir user@remote_host:other_dir_name

However, after it runs, on the remote host I get "other_dir_name/my_dir".

I don't want "my_dir" to be on the remote host.  I just want the files (and subdirectories) from "my_dir" to be replicated in "other_dir_name".

What syntax do I need?
phasevarAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
arunkeerthanConnect With a Mentor Commented:
Try

#  rsync -avz mydir/ user@remotehost:/otherdir/


Put the / as i told you....you will get it...dont misplace the /..


Thanks

Arunkeerthan
0
 
goodfela26Commented:
Try adding a "/" to my_dir, e.g. "rsync -aR my_dir/ user@remote_host:other_dir_name"
0
 
phasevarAuthor Commented:
No luck
0
 
gelonidaCommented:
add a slash AND  a .
rsync -aR my_dir/. user@remote_host:other_dir_name/.
0
 
phasevarAuthor Commented:
Had to take out the -R and add a trailing slash.  Thanks all!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.