Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to sync remote database copy using command

rsync --relative user@remote:/backup/databases/*.sql /backup/snapshots/

As it's result command creates file /backup/snapshots/backup/databases/mysql.sql. How can I force it to put file in /backup/snapshots/mysql.sql? It's mandatory that source must be remote (it's part of more complex script).

share|improve this question

2 Answers 2

up vote 3 down vote accepted

I think you don't want to use the --relative flag, as this creates subdirectories in the target location. Have you tried this?

From the man page:

 -R, --relative              use relative path names
share|improve this answer

What about passing rsync the --no-relative option?

share|improve this answer
    
This question is a year old, and has been solved. Please don't bump old questions like this. –  Sly Oct 2 '12 at 6:50
6  
@Sly If it's an answer that works, there's no reason to not post it. This site doesn't want to become a tomb of ancient (outdated) knowledge as many "forum" sites. That's why we close newer questions as duplicates of older ones, and encourage users to edit or answer old questions. –  Daniel Beck Oct 2 '12 at 9:38
1  
While this answer seems to be correct, not specifying --relative and specifying --no-relative should be the same in most situations, as --no-[OPTION] just disables -option... –  Daniel Beck Oct 2 '12 at 9:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.