Solved

rsync syntax

Posted on 2010-08-22
5
751 Views
Last Modified: 2013-12-16
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
Comment
Question by:phasevar
5 Comments
 

Expert Comment

by:goodfela26
ID: 33497964
Try adding a "/" to my_dir, e.g. "rsync -aR my_dir/ user@remote_host:other_dir_name"
0
 

Author Comment

by:phasevar
ID: 33498371
No luck
0
 
LVL 2

Accepted Solution

by:
arunkeerthan earned 500 total points
ID: 33499440
Try

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


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


Thanks

Arunkeerthan
0
 
LVL 16

Expert Comment

by:gelonida
ID: 33499995
add a slash AND  a .
rsync -aR my_dir/. user@remote_host:other_dir_name/.
0
 

Author Comment

by:phasevar
ID: 33504379
Had to take out the -R and add a trailing slash.  Thanks all!
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now