View previous topic :: View next topic |
Author |
Message |
friesia Apprentice
Joined: 23 Mar 2007 Posts: 202
|
Posted: Sat Apr 27, 2013 12:11 pm Post subject: rsync man page (-R) |
|
|
I can't realize what it says here about -R option in rsync man page.
Maybe someone can make an example?
Quote: |
-R, --relative
<skipped>
Beginning with rsync 3.0.0, rsync always sends these implied directories as real directories in the file
list, even if a path element is really a symlink on the sending side. This prevents some really unexpected
behaviors when copying the full path of a file that you didn’t realize had a symlink in its path. If you
want to duplicate a server-side symlink, include both the symlink via its path, and referent directory via
its real path. If you’re dealing with an older rsync on the sending side, you may need to use the
--no-implied-dirs option.
|
|
|
Back to top |
|
|
tomk Bodhisattva
Joined: 23 Sep 2003 Posts: 7221 Location: Sat in front of my computer
|
Posted: Sat Apr 27, 2013 12:40 pm Post subject: |
|
|
I just used this yesterday. Say you have a structure like this:
Code: | /dir1/foo
/dir1/bar
/dir2/baz |
And you run this command:
Code: | rsync -avz /dir1 /dir2 host:/dir3 |
You will end up with this:
Code: | /dir3/foo
/dir3/bar
/dir3/baz |
If you use:
Code: | rsync -avzR /dir1 /dir2 host:/dir3 |
You end up with this:
Code: | /dir3/dir1/foo
/dir3/dir1/bar
/dir3/dir2/baz |
It comes in very handy if you are rsyncing several directories at once. _________________ Search | Read | Answer | Report | Strip |
|
Back to top |
|
|
friesia Apprentice
Joined: 23 Mar 2007 Posts: 202
|
Posted: Sat Apr 27, 2013 4:04 pm Post subject: |
|
|
I understand what -R does (I skipped this part), I can't get the part about symlinking |
|
Back to top |
|
|
tomk Bodhisattva
Joined: 23 Sep 2003 Posts: 7221 Location: Sat in front of my computer
|
Posted: Sat Apr 27, 2013 8:34 pm Post subject: |
|
|
Ah OK, the problem it is getting round is that you could end up overwriting files on the receiving side you didn't intend to. So if you have a symlink in your structure:
Code: | /dir1/foo
/dir1/bar
/dir2/baz
/dir4 -> /dir2 |
And you run the following:
Code: | rsync -avzR /dir1 /dir4/baz host:/dir3 |
You end up with this on the receiving side:
Code: | /dir3/dir1/foo
/dir3/dir1/bar
/dir3/dir4/baz |
If rsync copied the implied directory (/dir4/) as a symlink you would end up with this:
Code: | /dir3/dir1/foo
/dir3/dir1/bar
/dir3/dir4/ -> /dir2/
/dir2/baz |
If you didn't realise that /dir4 was a symlink you've just written /dir2/baz without intending to. Say /dir2/ was /etc/ you could have done a lot of damage.
Does that make it any clearer? _________________ Search | Read | Answer | Report | Strip |
|
Back to top |
|
|
friesia Apprentice
Joined: 23 Mar 2007 Posts: 202
|
Posted: Sun Apr 28, 2013 6:04 am Post subject: |
|
|
Yes, it's clear now, thanks. |
|
Back to top |
|
|
|