How to make rsync to use relative path?

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).

1

2 Answers

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

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

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like