Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 789
  • Last Modified:

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?
0
phasevar
Asked:
phasevar
1 Solution
 
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
 
arunkeerthanCommented:
Try

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


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


Thanks

Arunkeerthan
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now