Can rsync copy directories over links
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have the following scenario where I need to copy directories which sometimes can be links and sometimes a directory with the same name. For instance, suppose this is the initial setup:
Source:
/workspace/test/source/dir1 -> /tmp/test1
Destination:
/workspace/test/dest/dir1 -> /tmp/test1
Now, suppose I remove the link in the source and create a folder with the same name, so now it looks like this:
Source:
/workspace/test/source/dir1
Destination:
/workspace/test/dest/dir1 -> /tmp/test1
What I'd like to do now, is to use rsync to copy the actual folder and "overwrite" the link, so it would look like:
Source:
/workspace/test/source/dir1
Destination:
/workspace/test/dest/dir1
Is there any way to do it via rsync? I know that if I use the rsync one level above, ie /workspace/test/source, it will work. Unfortunetly, I have to use the lowest level rsync.
Appreciate your response.
rsync symlink
add a comment |Â
up vote
0
down vote
favorite
I have the following scenario where I need to copy directories which sometimes can be links and sometimes a directory with the same name. For instance, suppose this is the initial setup:
Source:
/workspace/test/source/dir1 -> /tmp/test1
Destination:
/workspace/test/dest/dir1 -> /tmp/test1
Now, suppose I remove the link in the source and create a folder with the same name, so now it looks like this:
Source:
/workspace/test/source/dir1
Destination:
/workspace/test/dest/dir1 -> /tmp/test1
What I'd like to do now, is to use rsync to copy the actual folder and "overwrite" the link, so it would look like:
Source:
/workspace/test/source/dir1
Destination:
/workspace/test/dest/dir1
Is there any way to do it via rsync? I know that if I use the rsync one level above, ie /workspace/test/source, it will work. Unfortunetly, I have to use the lowest level rsync.
Appreciate your response.
rsync symlink
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have the following scenario where I need to copy directories which sometimes can be links and sometimes a directory with the same name. For instance, suppose this is the initial setup:
Source:
/workspace/test/source/dir1 -> /tmp/test1
Destination:
/workspace/test/dest/dir1 -> /tmp/test1
Now, suppose I remove the link in the source and create a folder with the same name, so now it looks like this:
Source:
/workspace/test/source/dir1
Destination:
/workspace/test/dest/dir1 -> /tmp/test1
What I'd like to do now, is to use rsync to copy the actual folder and "overwrite" the link, so it would look like:
Source:
/workspace/test/source/dir1
Destination:
/workspace/test/dest/dir1
Is there any way to do it via rsync? I know that if I use the rsync one level above, ie /workspace/test/source, it will work. Unfortunetly, I have to use the lowest level rsync.
Appreciate your response.
rsync symlink
I have the following scenario where I need to copy directories which sometimes can be links and sometimes a directory with the same name. For instance, suppose this is the initial setup:
Source:
/workspace/test/source/dir1 -> /tmp/test1
Destination:
/workspace/test/dest/dir1 -> /tmp/test1
Now, suppose I remove the link in the source and create a folder with the same name, so now it looks like this:
Source:
/workspace/test/source/dir1
Destination:
/workspace/test/dest/dir1 -> /tmp/test1
What I'd like to do now, is to use rsync to copy the actual folder and "overwrite" the link, so it would look like:
Source:
/workspace/test/source/dir1
Destination:
/workspace/test/dest/dir1
Is there any way to do it via rsync? I know that if I use the rsync one level above, ie /workspace/test/source, it will work. Unfortunetly, I have to use the lowest level rsync.
Appreciate your response.
rsync symlink
asked May 3 at 12:30
Emil Gelman
1
1
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
This is the default behaviour of rsync
.
Example
## Preamble
$ cd /tmp
$ mkdir src dst stuff
$ touch stuff/a,b,c
$ ( cd src && ln -s /tmp/stuff dir1 )
$ ( cd dst && ln -s /tmp/stuff dir1 )
## Symlinks are retained
$ cd /tmp
$ rsync -avv src/ dst/
## Change scenario
$ ls -l src
$ rm src/dir1 && cp -a /tmp/stuff src/dir1
## Symlinks are replaced according to the source
$ cd /tmp
$ rsync -avv src/ dst/
$ ls -l dst
Thanks for the comment. My intention is to rsync src/dir1 dst/dir1. I know that in top level it works, but the problem is I have to use the lowest level directory.
â Emil Gelman
May 6 at 10:02
@Emil it can't work below the symlink because that's not part of the copy process
â roaima
May 6 at 14:20
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
This is the default behaviour of rsync
.
Example
## Preamble
$ cd /tmp
$ mkdir src dst stuff
$ touch stuff/a,b,c
$ ( cd src && ln -s /tmp/stuff dir1 )
$ ( cd dst && ln -s /tmp/stuff dir1 )
## Symlinks are retained
$ cd /tmp
$ rsync -avv src/ dst/
## Change scenario
$ ls -l src
$ rm src/dir1 && cp -a /tmp/stuff src/dir1
## Symlinks are replaced according to the source
$ cd /tmp
$ rsync -avv src/ dst/
$ ls -l dst
Thanks for the comment. My intention is to rsync src/dir1 dst/dir1. I know that in top level it works, but the problem is I have to use the lowest level directory.
â Emil Gelman
May 6 at 10:02
@Emil it can't work below the symlink because that's not part of the copy process
â roaima
May 6 at 14:20
add a comment |Â
up vote
0
down vote
This is the default behaviour of rsync
.
Example
## Preamble
$ cd /tmp
$ mkdir src dst stuff
$ touch stuff/a,b,c
$ ( cd src && ln -s /tmp/stuff dir1 )
$ ( cd dst && ln -s /tmp/stuff dir1 )
## Symlinks are retained
$ cd /tmp
$ rsync -avv src/ dst/
## Change scenario
$ ls -l src
$ rm src/dir1 && cp -a /tmp/stuff src/dir1
## Symlinks are replaced according to the source
$ cd /tmp
$ rsync -avv src/ dst/
$ ls -l dst
Thanks for the comment. My intention is to rsync src/dir1 dst/dir1. I know that in top level it works, but the problem is I have to use the lowest level directory.
â Emil Gelman
May 6 at 10:02
@Emil it can't work below the symlink because that's not part of the copy process
â roaima
May 6 at 14:20
add a comment |Â
up vote
0
down vote
up vote
0
down vote
This is the default behaviour of rsync
.
Example
## Preamble
$ cd /tmp
$ mkdir src dst stuff
$ touch stuff/a,b,c
$ ( cd src && ln -s /tmp/stuff dir1 )
$ ( cd dst && ln -s /tmp/stuff dir1 )
## Symlinks are retained
$ cd /tmp
$ rsync -avv src/ dst/
## Change scenario
$ ls -l src
$ rm src/dir1 && cp -a /tmp/stuff src/dir1
## Symlinks are replaced according to the source
$ cd /tmp
$ rsync -avv src/ dst/
$ ls -l dst
This is the default behaviour of rsync
.
Example
## Preamble
$ cd /tmp
$ mkdir src dst stuff
$ touch stuff/a,b,c
$ ( cd src && ln -s /tmp/stuff dir1 )
$ ( cd dst && ln -s /tmp/stuff dir1 )
## Symlinks are retained
$ cd /tmp
$ rsync -avv src/ dst/
## Change scenario
$ ls -l src
$ rm src/dir1 && cp -a /tmp/stuff src/dir1
## Symlinks are replaced according to the source
$ cd /tmp
$ rsync -avv src/ dst/
$ ls -l dst
answered May 3 at 15:35
roaima
39.4k545106
39.4k545106
Thanks for the comment. My intention is to rsync src/dir1 dst/dir1. I know that in top level it works, but the problem is I have to use the lowest level directory.
â Emil Gelman
May 6 at 10:02
@Emil it can't work below the symlink because that's not part of the copy process
â roaima
May 6 at 14:20
add a comment |Â
Thanks for the comment. My intention is to rsync src/dir1 dst/dir1. I know that in top level it works, but the problem is I have to use the lowest level directory.
â Emil Gelman
May 6 at 10:02
@Emil it can't work below the symlink because that's not part of the copy process
â roaima
May 6 at 14:20
Thanks for the comment. My intention is to rsync src/dir1 dst/dir1. I know that in top level it works, but the problem is I have to use the lowest level directory.
â Emil Gelman
May 6 at 10:02
Thanks for the comment. My intention is to rsync src/dir1 dst/dir1. I know that in top level it works, but the problem is I have to use the lowest level directory.
â Emil Gelman
May 6 at 10:02
@Emil it can't work below the symlink because that's not part of the copy process
â roaima
May 6 at 14:20
@Emil it can't work below the symlink because that's not part of the copy process
â roaima
May 6 at 14:20
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441534%2fcan-rsync-copy-directories-over-links%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password